본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

React Templates

원문 보기 위키 갱신

출처: 문서

본문

Info alert:Beta feature This beta component is currently under review and is still open for further evolution. It is available for use in product. Beta components are considered for promotion on a quarterly basis. Please join in and give us your feedback or submit any questions via Slack. To learn more about the process, visit our about page or our Beta components page on GitHub.

Info alert:Templates This page showcases templates for the dropdown component. A template combines a component with logic that supports a specific use case, with a streamlined API that offers additional, limited customization.

Note: Templates live in their own package at @patternfly/react-templates! For custom use cases, please see the dropdown component suite from @patternfly/react-core.

Examples

Simple

Disable simple dropdown toggles

Props

SimpleDropdown

required | | Name | Type | Default | Description | toggleContentrequired | React.ReactNode | | Content of the toggle.

| initialItems | SimpleDropdownItem[] | | Initial items of the dropdown.

| isDisabled | boolean | | Flag indicating the dropdown should be disabled.

| isToggleFullWidth | boolean | | Flag indicated whether the dropdown toggle should take up the full width of its parent.

| onSelect | (event?: React.MouseEvent<Element, MouseEvent>, value?: SimpleDropdownItem['value']) => void | | Callback triggered when any dropdown item is clicked.

| onToggle | (nextIsOpen: boolean) => void | | Callback triggered when the dropdown toggle opens or closes.

| shouldFocusToggleOnSelect | boolean | | Flag indicating the dropdown toggle should be focused after a dropdown item is clicked.

| toggleAriaLabel | string | | Adds an accessible name to the dropdown toggle. Required when the dropdown toggle does not have any text content.

| toggleProps | MenuToggleProps | | Additional props passed to the toggle.

| toggleVariant | 'default' | 'plain' | 'plainText' | | Variant style of the dropdown toggle.

| toggleWidth | string | | Width of the toggle.

SimpleDropdownItem

required | | Name | Type | Default | Description | valuerequired | string | number | | Unique identifier for the dropdown item, which is used in the dropdown onSelect callback

| content | React.ReactNode | | Content of the dropdown item. If the isDivider prop is true, this prop will be ignored.

| isDivider | boolean | | Flag indicating whether the dropdown item should render as a divider. If true, the item will be rendered without the dropdown item wrapper.

| onClick | (event?: any) => void | | Callback for when the dropdown item is clicked.

| to | string | | URL to redirect to when the dropdown item is clicked.

Edit this page on GitHub

더 알아보기 (Learn more)