())
- .child(
- StorySection::new().child(StoryItem::new(
- "Vertical Tool Strip",
- h_flex().child(
- ToolStrip::vertical("tool_strip_example")
- .tool(
- IconButton::new("example_tool", IconName::AudioOn)
- .tooltip(Tooltip::text("Example tool")),
- )
- .tool(
- IconButton::new("example_tool_2", IconName::MicMute)
- .tooltip(Tooltip::text("Example tool 2")),
- )
- .tool(
- IconButton::new("example_tool_3", IconName::Screen)
- .tooltip(Tooltip::text("Example tool 3")),
- ),
- ),
- )),
- )
- }
-}
diff --git a/crates/ui/src/components/tab.rs b/crates/ui/src/components/tab.rs
index 4d991bd6ce8482a1c123ebf3df58ab48f26b646f..362f1a41a59610678bd0f96603fadec34d47cb3c 100644
--- a/crates/ui/src/components/tab.rs
+++ b/crates/ui/src/components/tab.rs
@@ -27,7 +27,7 @@ pub enum TabCloseSide {
End,
}
-#[derive(IntoElement)]
+#[derive(IntoElement, IntoComponent)]
pub struct Tab {
div: Stateful,
selected: bool,
@@ -171,3 +171,48 @@ impl RenderOnce for Tab {
)
}
}
+
+impl ComponentPreview for Tab {
+ fn preview(_window: &mut Window, _cx: &App) -> AnyElement {
+ v_flex()
+ .gap_6()
+ .children(vec![example_group_with_title(
+ "Variations",
+ vec![
+ single_example(
+ "Default",
+ Tab::new("default").child("Default Tab").into_any_element(),
+ ),
+ single_example(
+ "Selected",
+ Tab::new("selected")
+ .toggle_state(true)
+ .child("Selected Tab")
+ .into_any_element(),
+ ),
+ single_example(
+ "First",
+ Tab::new("first")
+ .position(TabPosition::First)
+ .child("First Tab")
+ .into_any_element(),
+ ),
+ single_example(
+ "Middle",
+ Tab::new("middle")
+ .position(TabPosition::Middle(Ordering::Equal))
+ .child("Middle Tab")
+ .into_any_element(),
+ ),
+ single_example(
+ "Last",
+ Tab::new("last")
+ .position(TabPosition::Last)
+ .child("Last Tab")
+ .into_any_element(),
+ ),
+ ],
+ )])
+ .into_any_element()
+ }
+}
diff --git a/crates/ui/src/components/table.rs b/crates/ui/src/components/table.rs
index c1918829791a6e14b7e9f8dbaeae9307c5439c23..aa955a6d089ee30d922b5cbc2104391e164a51ba 100644
--- a/crates/ui/src/components/table.rs
+++ b/crates/ui/src/components/table.rs
@@ -2,7 +2,7 @@ use crate::{prelude::*, Indicator};
use gpui::{div, AnyElement, FontWeight, IntoElement, Length};
/// A table component
-#[derive(IntoElement)]
+#[derive(IntoElement, IntoComponent)]
pub struct Table {
column_headers: Vec,
rows: Vec>,
@@ -152,88 +152,110 @@ where
}
impl ComponentPreview for Table {
- fn description() -> impl Into