@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)
更多
你可能也喜欢
- @01ht/ht-toolbar-signin 中文文档教程
- @0x-lerna-fork/log-packed 中文文档教程
- @10duke/web-client-pkce 中文文档教程
- @1ziton/react-native-scancode 中文文档教程
- @36node/bus-log-sdk 中文文档教程
- @3test/ethereum-order-gateway 中文文档教程
- @4react/tsconfig 中文文档教程
- @_tw/typography 中文文档教程
- @aarhus-university/au-designsystem-delphinus 中文文档教程
- @abcfe/react-native-growingio 中文文档教程