@gfazioli/mantine-picker
A Mantine component that allows you to create a picker effect with a list of elements.
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-picker by importing @gfazioli/mantine-picker/styles.layer.css file.
Usage
The Picker component allows you to create a picker effect with any list of items.
It's inspired by the iOS picker and allows you to create a similar effect with any list of items.
- You can drag up and down to select the item you want
- You may also use the mouse wheel to scroll through the items
- Of course, you can also click on the item to select it
- Finally, you can use the keyboard to navigate through the items
Value: RomeonChange
You can use the onChange prop to get the selected item. It is called whenever the selected value changes, allowing you to handle the selection logic in your application. Of course, you can also use the value prop to control the selected item.
Value: AprilrenderItem
You can use the renderItem prop to customize the rendering of each item. This prop receives the item as arguments and should return the JSX to be rendered.
Value: 3D Effect
The Picker features a built-in 3D cylinder rotation effect inspired by the iOS picker. Configure it with:
enable3D— toggle the 3D effect (default:true)perspective— depth perspective in pixels (default:300)maxRotation— maximum rotation angle in degrees (default:60)cylinderRadius— curvature factor (default:4)rotateY— rotate the entire picker along the Y-axis (default:0)
Visual Effects
Non-selected items can be styled with gradual blur, opacity, and scale effects:
maxBlurAmount— maximum blur in pixels for non-selected items (default:0)minItemOpacity— minimum opacity at the edges (default:0.3)minItemScale— minimum scale at the edges (default:0.85)
Blur
Opacity
Scale
Combined
Mask
Enable a gradient mask at the top and bottom edges with withMask. Control the gradient intensity with maskHeight (percentage of picker height) and maskIntensity (gradient opacity).
Default (no mask)
With mask
Intense mask
Left and Right Sections
You can use the leftSection and rightSection props to add custom content to the left and right sides of the picker. This is useful for adding icons, buttons, or any other content you want.
As you can see, by using leftSection and rightSection props you can add any content you want to the left and right sides of the picker. In these cases the sections are fixed and do not scroll with the items. They will also inside the picker.
Alternatively, you can use a simple <Group/> component to add any left (center) and right section you want.
👉
👈
:
Styles the Picker
You can change the default styles of the items by using the same props you use in the <Text/> component.
readOnly
In addition to the disabled prop, you can use the readOnly prop to make the picker read-only. This will prevent the user from changing the selected item, but will still allow you to change it programmatically. It can be useful when you want to display the selected item without allowing the user to change it.
Accessibility
The Picker component provides built-in keyboard navigation and screen reader support:
- Arrow Up/Down — move one item up/down
- Home/End — jump to first/last item
- Page Up/Down — move 5 items at a time
role="listbox"androle="option"for semantic structurearia-selectedon the active itemaria-disabledandaria-readonlywhen applicable
Use the id, label, description, and keyboardHint props to provide additional context for assistive technologies. Set focusable={false} to exclude the picker from the tab order.
Example: Time Picker
The Picker component can be used as a Time Picker. You can use the renderItem prop to customize the rendering of each item and the onChange prop to handle the selection logic. In this example, we will create a simple time picker that allows you to select the hour and minute.
🕑
:
min
Selected time: 14:8
:
Selected time: 02:8 pm
Example: Date Picker
The Picker component can be used as a Date Picker.
Selected date: 09 April 2026
Example: Slot Machine
As funny as it may sound, the Picker component can be used to create a slot machine effect.
🎉 Jackpot! 🎉