MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / BlockTabs

Function BlockTabs

preview/src/main.rs:1620–1701  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1618
1619#[component]
1620fn BlockTabs() -> Element {
1621 let members: &[(&str, &str, &str, &str)] = &[
1622 ("Avery Lin", "Eng lead", "online", "AL"),
1623 ("Casey Park", "Design", "away", "CP"),
1624 ("Robin Hayes", "PM", "offline", "RH"),
1625 ];
1626 let activity: &[(&str, &str, &str)] = &[
1627 ("Casey", "shipped v2.4.1", "12m ago"),
1628 ("Avery", "opened PR #482", "1h ago"),
1629 ("Robin", "moved 4 tasks", "3h ago"),
1630 ];
1631 rsx! {
1632 div { style: "display: grid; gap: 0.3rem; margin-bottom: 1.1rem;",
1633 h3 { style: "margin: 0; font-size: 1rem; font-weight: 660; color: var(--secondary-color-3);", "Workspace" }
1634 p { style: "margin: 0; color: var(--secondary-color-5); font-size: 0.85rem;", "Team activity at a glance." }
1635 }
1636 Tabs {
1637 default_value: "members".to_string(),
1638 horizontal: true,
1639 width: "100%",
1640 TabList {
1641 TabTrigger { value: "members".to_string(), index: 0usize, "Members" }
1642 TabTrigger { value: "activity".to_string(), index: 1usize, "Activity" }
1643 TabTrigger { value: "files".to_string(), index: 2usize, "Files" }
1644 }
1645 TabContent { index: 0usize, value: "members".to_string(),
1646 div { style: "display: grid; gap: 0.85rem;",
1647 for member in members.iter() {
1648 div { style: "display: flex; align-items: center; gap: 0.7rem;",
1649 ImageAvatar {
1650 size: AvatarImageSize::Small,
1651 src: "https://avatar.vercel.sh/{member.0}",
1652 alt: "{member.0}",
1653 aria_label: "{member.0}",
1654 "{member.3}"
1655 }
1656 div { style: "flex: 1; min-width: 0;",
1657 div { style: "font-weight: 540; color: var(--secondary-color-3); font-size: 0.9rem;", "{member.0}" }
1658 div { style: "color: var(--secondary-color-5); font-size: 0.78rem;", "{member.1}" }
1659 }
1660 span {
1661 style: match member.2 {
1662 "online" => "width: 0.55rem; height: 0.55rem; border-radius: 999px; background-color: rgb(34,197,94);",
1663 "away" => "width: 0.55rem; height: 0.55rem; border-radius: 999px; background-color: rgb(234,179,8);",
1664 _ => "width: 0.55rem; height: 0.55rem; border-radius: 999px; background-color: var(--primary-color-6);",
1665 },
1666 }
1667 }
1668 }
1669 }
1670 }
1671 TabContent { index: 1usize, value: "activity".to_string(),
1672 div { style: "display: grid; gap: 0.85rem;",
1673 for entry in activity.iter() {
1674 div { style: "display: flex; align-items: baseline; gap: 0.45rem; font-size: 0.88rem;",
1675 span { style: "font-weight: 600; color: var(--secondary-color-3);", "{entry.0}" }
1676 span { style: "color: var(--secondary-color-5);", "{entry.1}" }
1677 span { style: "margin-left: auto; color: var(--secondary-color-5); font-size: 0.78rem; white-space: nowrap;", "{entry.2}" }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected