Web 0.2.0
- Defaultlight16.95 : 1AA 4.5dark16.95 : 1AA 4.5
- measured on 0.2.0
npx shadcn@latest add @maeso/segment-thumb- Size
- 1.6 kB gzipmeasured on 0.2.0
- First install
- Add the registry once
Usage
Position the thumb behind the selected segment. Let the owning control provide selection and interaction semantics.
Accessibility
Treat the thumb as decoration. The owning control must expose selection without relying on position or animation.
When to use
Use inside a segmented control as its selection indicator. Do not use it as a standalone input.
Install
Add this registry to your project's components.json once, before the first install. Keep your existing settings and other registries.
{
"registries": {
"@maeso": "http://127.0.0.1:4321/r/{name}.json"
}
}Then install the registry's default theme once, and import its sheet in the CSS entry that imports Tailwind. It paints every item from this registry.
npx shadcn@latest add @maeso/maeso@import "./styles/theme.web.css";npx shadcn@latest add @maeso/segment-thumbProps
SegmentThumb
| Prop | Type | Required | Description |
|---|---|---|---|
| at | number | yes | The chosen cell, `0` to `count - 1`; out of range draws no thumb. |
| count | number | yes | The number of equal cells; 0 draws no thumb, and 1 fills the single cell. |
Proof
Contrast
measured on 0.2.0
| State | Foreground | Background | Ratio | Floor |
|---|---|---|---|---|
| default | rgb(7 21 34) | rgb(248 245 240) | 16.95 | AA 4.5 |
| default (dark) | rgb(248 245 240) | rgb(7 21 34) | 16.95 | AA 4.5 |
Size
1553 gzip bytes · measured on 0.2.0
Motion
The selection thumb travels to the active segment.
Configured duration: 200 ms
Reduced motion: none
Motion timing
Observed duration: 200 ms · measured on 0.2.0
Reduced motion
passed · measured on 0.2.0
Example
import { SegmentThumb } from "@/components/ui/_kit/core/segment-thumb/SegmentThumb";
const Example = () => (
<div className="relative grid grid-cols-3 w-full max-w-75 p-1 border border-border rounded-lg bg-surface-base">
<SegmentThumb count={3} at={1} />
{["One", "Two", "Three"].map((label) => (
<span key={label} className="px-2 py-1.5 text-center text-(length:--text-xs) text-inherit">
{label}
</span>
))}
</div>
);
export default Example;not on native yet