Fan Menu
React Native (Expo)
A React Native floating button that fans its actions out along an arc, springing them out one after another.
A floating button that fans its actions out along an arc. The items spring out one after another, the plus turns into a cross, and picking an item folds the fan away. Place it with style; the items are positioned from the button, so keep room for the arc on that side. Built for React Native and Expo with react-native only; this page previews it in the browser through react-native-web.
Installation
CLI
npx @modus-ui/cli add fan-menuManual
- Copy the code from the component tab.
- Create a file at
components/ui/fan-menu.tsx. - Paste the code.
It needs no packages beyond react-native, which your Expo or React Native app already has.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | FanMenuItem[] | - | The actions. Each has a spoken label, an icon and an onPress. |
label | string | "Actions" | Spoken label of the main button. |
size | number | 58 | Diameter of the main button. |
radius | number | 104 | Distance from the main button to each item. |
startAngle | number | 180 | Where the fan starts, in degrees: 0 is right, 90 down, 180 left, 270 up. |
endAngle | number | 270 | Where the fan ends, in degrees. |
colors | Partial<FanMenuColors> | - | Overrides button, bar and item. |
style | StyleProp<ViewStyle> | - | Style for the button's container, for example to position it. |
Comments