@acusti/dropdown 中文文档教程
@acusti/dropdown
Dropdown
是一个 React 组件,它呈现一个带有触发器的类似菜单的 UI 用户单击以显示位于触发器下方的下拉菜单。 下拉列表的主体可以包含任何 DOM,并且可以是许多下拉列表 组合成一个多项目菜单,就像顶部工具栏中的系统菜单 macOS 的。
该组件存在的三个主要设计目标:
- Best-in-class UX (inspired by macOS native menus) with excellent keyboard support
- Best-in-class DX with the simplest possible API:
- To create a dropdown with a
<button>
trigger, pass in a single child element with the body of the dropdown - To create a dropdown with a custom trigger, pass in exactly two child elements; the first is the trigger, the second is the body of the dropdown
- To create a dropdown with a list of items as the body, use the
data-ukt-item
boolean to mark dropdown items, or usedata-ukt-value="foo"
to specify that an element is a dropdown item and the value of that item at the same time (otherwise, the value is the text content of the dropdown item element) - To style your dropdowns, use CSS; there are a collection of CSS variables used internally to style them if that works best for you, or just override the minimal default CSS as appropriate
- To create a dropdown with a
- Lightweight bundle size with the bare minimum of dependencies (see minzipped size above)
@acusti/dropdown
Dropdown
is a React component that renders a menu-like UI with a trigger that the user clicks to disclose a dropdown positioned below the trigger. The body of the dropdown can include any DOM, and many dropdowns can be combined to form a multi-item menu, like the system menu in the top toolbar of macOS.
The three primary design goals for the existence of this component:
- Best-in-class UX (inspired by macOS native menus) with excellent keyboard support
- Best-in-class DX with the simplest possible API:
- To create a dropdown with a
<button>
trigger, pass in a single child element with the body of the dropdown - To create a dropdown with a custom trigger, pass in exactly two child elements; the first is the trigger, the second is the body of the dropdown
- To create a dropdown with a list of items as the body, use the
data-ukt-item
boolean to mark dropdown items, or usedata-ukt-value="foo"
to specify that an element is a dropdown item and the value of that item at the same time (otherwise, the value is the text content of the dropdown item element) - To style your dropdowns, use CSS; there are a collection of CSS variables used internally to style them if that works best for you, or just override the minimal default CSS as appropriate
- To create a dropdown with a
- Lightweight bundle size with the bare minimum of dependencies (see minzipped size above)
更多
你可能也喜欢
- 4chan 中文文档教程
- 6cjxsscyfifgqq48wwvh6r4byjv8xluc 中文文档教程
- @0x/fill-scenarios 中文文档教程
- @0xcert/ethereum-bitski-frontend-provider 中文文档教程
- @24hr/progressive-loadable 中文文档教程
- @4dsas/doc_preprocessing 中文文档教程
- @5ire/ui-kit 中文文档教程
- @a2000/window 中文文档教程
- @aanton/telegram-webpage-monitor-bot 中文文档教程
- @aaronconway7/create-gatsby-app 中文文档教程