thaw/demo_markdown/docs/popover/mod.md

167 lines
5.2 KiB
Markdown
Raw Normal View History

# Popover
```rust demo
view! {
<Space>
<Popover>
<PopoverTrigger slot>
<Button>"Hover"</Button>
</PopoverTrigger>
"Content"
</Popover>
<Popover trigger_type=PopoverTriggerType::Click>
<PopoverTrigger slot>
<Button>"Click"</Button>
</PopoverTrigger>
"Content"
</Popover>
</Space>
}
```
### Placement
```rust demo
use leptos_meta::Style;
view! {
<Style>
".demo-popover .thaw-button { width: 100% } .demo-popover .thaw-popover-trigger { display: block }"
</Style>
<Grid x_gap=8 y_gap=8 cols=3 class="demo-popover">
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::TopStart>
<PopoverTrigger slot>
<Button>"Top Start"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::Top>
<PopoverTrigger slot>
<Button>"Top"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::TopEnd>
<PopoverTrigger slot>
<Button>"Top End"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::LeftStart trigger_type=PopoverTriggerType::Click>
<PopoverTrigger slot>
<Button>"Left Start"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem offset=1>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::RightStart>
<PopoverTrigger slot>
<Button>"Right Start"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::Left trigger_type=PopoverTriggerType::Click>
<PopoverTrigger slot>
<Button>"Left"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem offset=1>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::Right>
<PopoverTrigger slot>
<Button>"Right"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::LeftEnd>
<PopoverTrigger slot>
<Button>"Left End"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem offset=1>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::RightEnd>
<PopoverTrigger slot>
<Button>"Right End"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::BottomStart>
<PopoverTrigger slot>
<Button>"Bottom Start"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::Bottom>
<PopoverTrigger slot>
<Button>"Bottom"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
<GridItem>
2024-07-27 18:04:36 +08:00
<Popover position=PopoverPosition::BottomEnd>
<PopoverTrigger slot>
<Button>"Bottom End"</Button>
</PopoverTrigger>
"Content"
</Popover>
</GridItem>
</Grid>
}
```
2024-06-11 16:48:41 +08:00
### Appearance
2024-04-13 18:49:30 +08:00
```rust demo
view! {
<Space>
2024-06-11 16:48:41 +08:00
<Popover appearance=PopoverAppearance::Brand>
<PopoverTrigger slot>
<Button>"Hover"</Button>
</PopoverTrigger>
"Content"
</Popover>
<Popover appearance=PopoverAppearance::Inverted>
2024-04-13 18:49:30 +08:00
<PopoverTrigger slot>
<Button>"Hover"</Button>
</PopoverTrigger>
"Content"
</Popover>
</Space>
}
```
### Popover Props
2024-07-27 18:04:36 +08:00
| Name | Type | Default | Description |
| -------- | ----------------------------------- | ---------------------- | ----------------------------- |
| class | `OptionalProp<MaybeSignal<String>>` | `Default::default()` | Content class of the popover. |
| position | `PopoverPosition` | `PopoverPosition::Top` | Popover position. |
| tooltip | `bool` | `false` | Tooltip. |
| children | `Children` | | The content inside popover. |
### Popover Slots
| Name | Default | Description |
| -------------- | ------- | ----------------------------------------------- |
| PopoverTrigger | | The element or component that triggers popover. |