Dropdown有两Slot:TriggerSlot和MenuSlot, MenuSlot可以使用子组件DropdownItem和DropdownDivider填充
Dropdown有两Slot:TriggerSlot和MenuSlot, MenuSlot可以使用子组件DropdownItem和DropdownDivider填充
<Dropdown IsActive>
<TriggerSlot>
<Button>
<span>Dropdown button</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem Href="#">Dropdown Item</DropdownItem>
<DropdownItem Href="#">Other dropdown item</DropdownItem>
<DropdownItem Href="#" IsActive>Active dropdown item</DropdownItem>
<DropdownItem Href="#">Other dropdown item</DropdownItem>
<DropdownDivider/>
<DropdownItem Href="#"> With a divider</DropdownItem>
</MenuSlot>
</Dropdown>
<Dropdown IsActive>
<TriggerSlot>
<Button>
<span>Dropdown button</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem>
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem>
<p>You simply need to use a <code><div></code> instead.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem Href="#"> This is a link</DropdownItem>
</MenuSlot>
</Dropdown>
<Dropdown>
<TriggerSlot>
<Button>
<span>Hoverable Dropdown</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem>
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem Href="#"> This is a link</DropdownItem>
</MenuSlot>
</Dropdown>
<Dropdown IsClickTrigger>
<TriggerSlot>
<Button>
<span>Clickable Dropdown</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem>
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem Href="#"> This is a link</DropdownItem>
</MenuSlot>
</Dropdown>
<Dropdown IsRight>
<TriggerSlot>
<Button>
<span>Hoverable IsRight</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem>
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem Href="#"> This is a link</DropdownItem>
</MenuSlot>
</Dropdown>
<Dropdown IsClickTrigger IsUp @ref="dd">
<TriggerSlot>
<Button>
<span>Clickable IsUp</span>
<Icon IsSmall IconClass="fa fa-angle-down"></Icon>
</Button>
</TriggerSlot>
<MenuSlot>
<DropdownItem>
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</DropdownItem>
<DropdownDivider/>
<DropdownItem >
<Button @onclick="close">Close</Button>
</DropdownItem>
</MenuSlot>
</Dropdown>
@code{
Dropdown dd;
void close()
{
dd.Toggle();
}
}
文档