|
| 1 | +--- |
| 2 | +id: action-sheet |
| 3 | +title: ActionSheet |
| 4 | +--- |
| 5 | + |
| 6 | +import { ComponentTheme } from '../../src/components'; |
| 7 | + |
| 8 | +An Action Sheet is a dialog that displays a set of options. It appears on top of the app's content. |
| 9 | + |
| 10 | +## Import |
| 11 | + |
| 12 | +NativeBase exports 3 modal-related components: |
| 13 | + |
| 14 | +- **Actionsheet**: Provides the context and state for all components. |
| 15 | +- **Actionsheet.Content**: Component to wrap the list of **Actionsheet.Item** components. |
| 16 | +- **Actionsheet.Item**: A button to wrap the options of the Actionsheet. |
| 17 | + |
| 18 | +```jsx |
| 19 | +import { Actionsheet } from 'native-base'; |
| 20 | +``` |
| 21 | + |
| 22 | +## Examples |
| 23 | + |
| 24 | +### Usage |
| 25 | + |
| 26 | +```ComponentSnackPlayer path=components,composites,Actionsheet,Usage.tsx |
| 27 | + |
| 28 | +``` |
| 29 | + |
| 30 | +### Composition |
| 31 | + |
| 32 | +```ComponentSnackPlayer path=components,composites,Actionsheet,Composition.tsx |
| 33 | + |
| 34 | +``` |
| 35 | + |
| 36 | +### DisableOverlay |
| 37 | + |
| 38 | +```ComponentSnackPlayer path=components,composites,Actionsheet,DisableOverlay.tsx |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | +### Icons |
| 43 | + |
| 44 | +```ComponentSnackPlayer path=components,composites,Actionsheet,Icon.tsx |
| 45 | + |
| 46 | +``` |
| 47 | + |
| 48 | +## Props |
| 49 | + |
| 50 | +### Actionsheet |
| 51 | + |
| 52 | +```ComponentPropTable path=composites,Actionsheet,Actionsheet.tsx |
| 53 | + |
| 54 | +``` |
| 55 | + |
| 56 | +### Actionsheet.Content |
| 57 | + |
| 58 | +```ComponentPropTable path=composites,Actionsheet,ActionsheetContent.tsx |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +### Actionsheet.Item |
| 63 | + |
| 64 | +ActionsheetItem implements [Button](button.md#props) |
| 65 | + |
| 66 | +## Styling |
| 67 | + |
| 68 | +<ComponentTheme name="actionsheet" /> |
| 69 | + |
| 70 | +## Accessibility |
| 71 | + |
| 72 | +- ActionSheet has `aria-modal` set to true. |
| 73 | +- ActionSheet has `role` set to `dialog`. |
| 74 | +- When the ActionSheet opens, focus is trapped within it. |
| 75 | +- Pressing Esc closes the ActionSheet. |
| 76 | +- When the ActionSheet opens, focus is automatically set to the first enabled element. |
| 77 | +- Clicking on the overlay closes the ActionSheet. |
| 78 | +- Scrolling is blocked on the elements behind the ActionSheet. |
0 commit comments