;
+
+export const Example: Story = {
+ args: { defaultValue: 30, style: { width: 300 } },
+ render: (args) => (
+
+
+
+
+
+
+
+
+ ),
+};
+
+export const Range: Story = {
+ args: { defaultValue: [25, 75], style: { width: 300 } },
+ render: (args) => (
+
+
+
+ {({ state }) => state.values.map((_, i) => state.getThumbValueLabel(i)).join(' – ')}
+
+
+ {({ state }) => (
+ <>
+
+ {state.values.map((_, i) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: a thumb's index is its stable identity
+
+ ))}
+ >
+ )}
+
+
+ ),
+};
+
+export const Vertical: Story = {
+ args: {
+ defaultValue: 40,
+ orientation: 'vertical',
+ 'aria-label': 'Volume',
+ style: { height: 200 },
+ },
+ render: (args) => (
+
+
+
+
+
+
+ ),
+};
+
+export const Disabled: Story = {
+ args: { defaultValue: 60, isDisabled: true, style: { width: 300 } },
+ render: (args) => (
+
+
+
+
+
+
+
+
+ ),
+};
+
+const formats: Array<{
+ label: string;
+ minValue: number;
+ maxValue: number;
+ step?: number;
+ defaultValue: number | number[];
+ formatOptions: Intl.NumberFormatOptions;
+}> = [
+ {
+ label: 'Budget (currency)',
+ minValue: 0,
+ maxValue: 1000,
+ defaultValue: [250, 750],
+ formatOptions: { style: 'currency', currency: 'USD' },
+ },
+ {
+ label: 'Opacity (percent)',
+ minValue: 0,
+ maxValue: 1,
+ step: 0.01,
+ defaultValue: [0.2, 0.6],
+ formatOptions: { style: 'percent' },
+ },
+ {
+ label: 'Distance (unit)',
+ minValue: 0,
+ maxValue: 100,
+ defaultValue: 12,
+ formatOptions: { style: 'unit', unit: 'kilometer' },
+ },
+ {
+ label: 'Temperature (unit)',
+ minValue: -10,
+ maxValue: 40,
+ defaultValue: 21,
+ formatOptions: { style: 'unit', unit: 'celsius' },
+ },
+ {
+ label: 'Weight (decimal)',
+ minValue: 0,
+ maxValue: 10,
+ step: 0.1,
+ defaultValue: 2.5,
+ formatOptions: { minimumFractionDigits: 2 },
+ },
+];
+
+export const Formatted: Story = {
+ render: () => (
+
+ {formats.map(({ label, ...args }) => (
+
+
+
+
+ {({ state }) => (
+ <>
+
+ {state.values.map((_, i) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: a thumb's index is its stable identity
+
+ ))}
+ >
+ )}
+
+
+ ))}
+
+ ),
+};