@gfazioli/mantine-lens-select
A fisheye/lens magnification select component for React applications built with Mantine. Displays items with a macOS Dock-like magnification effect on hover, supporting horizontal and vertical orientations.
Installation
After installation import package styles at the root of your application:
You can import styles within a layer
@layer mantine-lens-select by importing
@gfazioli/mantine-lens-select/styles.layer.css file.
Usage
The LensSelect component displays a list of items with a
fisheye/lens magnification effect on hover — similar to
the macOS Dock. Items near the cursor scale up, creating
an interactive selection experience.
When no view is provided in data items, the component
renders default pills (rounded vertical bars). You can
customize their appearance with pillWidth, pillHeight,
pillRadius, pillColor, hoverColor, and activeColor
props.
Count mode
For simple numeric selection, use the count prop
instead of data. This generates pills automatically
with numeric values — no array needed.
Combine with min and max for a custom range,
or use step for fixed increments (similar to
Mantine's Slider API):
Use precision to control decimal places for
generated values.
Simple count (1..15): 1
Range 0–100 (20 pills): 50
Step 10 (0, 10, 20, ..., 100): 0
Controlled
The LensSelect component supports both controlled and
uncontrolled modes via value/defaultValue and
onChange. Use the slider below to drive the selection
externally:
Selected: 6
Variants
Both LensSelect and LensSelect.Indicator support
default and outline variants. The outline variant
renders pills and indicator with borders instead of filled
backgrounds. You can mix variants independently:
Default variant
Outline variant
Outline variant with outline indicator
Default variant with outline indicator
LensSelect.Indicator
The indicator is a compound component that shows a dot
below the selected item. It can be used automatically
via withIndicator prop or explicitly as a child with
its own props (color, size, offset, variant):
You can also pass indicator props from the parent via
indicatorProps:
Keyboard navigation
The component is fully operable from the keyboard. Focus lands on the track itself — a single tab stop, regardless of how many items it holds — and the arrow keys move the selection from there:
- Arrow Left / Arrow Right — previous / next item, in horizontal orientation
- Arrow Up / Arrow Down — previous / next item, in vertical orientation
- Home — jump to the first item
- End — jump to the last item
The track is a listbox and each item an option, with the active one advertised through
aria-activedescendant, so screen readers announce the selection as it moves. The items are
deliberately not individual tab stops: that keeps the tab order of a page with several selects
predictable.
Use Cases
macOS Dock
Use renderItem with custom icons and a Paper
container to recreate the macOS Dock experience:
Active: finder
Weekday Selector
Use data with custom view to build a day picker.
Weekend days (Sat, Sun) are highlighted in red — both
the label text and the active indicator color change
dynamically based on the selected value:
Selected: Mon
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Rating / Volume Selector
Use count for a quick numeric selector — no data
array needed:
Volume: 5/10
Vertical Timeline
Use orientation="vertical" to create a timeline
selector inspired by macOS Time Machine:
Dec 2025
Selected date in the timeline
Styles API
LensSelect supports
Styles API, you
can add styles to any inner element of the component with
classNames prop. Follow
Styles API
documentation to learn more.
Component Styles API
Hover over selectors to highlight corresponding elements