Skip to content

Theming

The component uses CSS custom properties for all visual values. Override them to match your design system.

[data-fractional-range] {
--fr-bg: #111;
--fr-border: #222;
--fr-color: #fff;
--fr-active-color: #fff;
--fr-disabled-color: #6d6d6d;
--fr-font-sans: 'Geist', system-ui, sans-serif;
--fr-font-mono: 'GeistMono', monospace;
--fr-fraction-small-height: 0.5rem;
--fr-fraction-large-height: 0.75rem;
--fr-fraction-width: 1.5px;
--fr-fraction-gap: 0.375rem;
--fr-shadow-width: 4rem;
--fr-radius: 0.75rem;
--fr-indicator-size: 0.25rem;
}

Use the color and activeColor props for quick color changes — they set --fr-color and --fr-active-color via inline styles:

<FractionalRange
color="#ccc"
activeColor="#4ade80"
min={0}
max={1}
step={0.1}
/>

Override the custom properties in your CSS to theme all instances at once:

[data-fractional-range] {
--fr-bg: #1a1a2e;
--fr-border: #2a2a4e;
--fr-color: #a0a0c0;
--fr-active-color: #7c3aed;
--fr-radius: 1rem;
--fr-font-mono: 'JetBrains Mono', monospace;
}

The component uses data attributes for styling, which you can target in CSS:

AttributeElementDescription
data-fractional-rangeRootThe root container.
data-compactRootPresent when no titlebar or indicator is shown.
data-disabledRootPresent when the component is disabled.
data-sliderSlider trackThe draggable strip of fractions.
data-fractionTickIndividual fraction tick mark.
data-size="small"TickSmall tick mark.
data-size="large"TickLarge tick mark (every 5th).
data-in-range="true"TickTick is within the active range.
data-fraction-labelLabelValue label shown above large ticks.
data-titlebarTitlebarThe titlebar container.
data-valueValueThe value display.
data-indicator-dotDotThe indicator dot.
data-shadow-leftShadowLeft gradient shadow.
data-shadow-rightShadowRight gradient shadow.