AvatarPicker
Pick an avatar from a grid. One accent ring glides to your choice, the big preview swaps on a spring, arrow keys move across the grid and Shuffle rolls a random one. Inputs.
Open playgroundAvatar 3
About
AvatarPicker is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { AvatarPicker } from "@ashutoshswamy/smoui" and set label, options, value among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { AvatarPicker } from "@ashutoshswamy/smoui";
<AvatarPicker label="Profile picture" defaultValue="2" onChange={(id) => save(id)} />Props 4
- label
Accessible name for the group.
string- options
Choices. Give `src` for photos or `palette` (0-7) for a mesh.
{ id; name; src?; palette? }[]default8 mesh avatars- value / defaultValue / onChange
Selected option id, controlled or not.
string / string / (id) => void- size / ringColor
Choice size, and the gap colour cut around the ring. Match the surface behind.
number / stringdefault56 / "var(--smoui-ring, Canvas)"
More inputs components
- AddressAutocompleteType a street and pick from live suggestions. Lookups wait for a pause, show a spinner and drop stale answers. Picking confirms the full address underneath.
- AvatarUploadDrop or choose a photo, then frame it under a crop circle. The stage shows the whole photo, the circle shows what you keep, and three live previews follow every move. Drag, zoom or use the arrow keys.
- CheckboxBox squashes on press, fills with the accent and draws its tick in.
- ChipA selectable pill. Selecting it tints it and slides a tick in at the front while the pill grows; an optional close button removes it.
- ColorPickerSaturation field and hue strip with jelly thumbs on springs. Edit the hex, pick a swatch, or use arrow keys.
- ComboboxType to narrow, arrows to move, Enter to choose. Matched text is bold, rows can carry a second line, the chosen row has a tick, and a clear button resets it.