Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Forms

TwSlider

TwSlider is a Blazor slider component for choosing a number in a range. Bind Value and set Min, Max, Step and Color.

Last updated 6 October 2026

Basic usage

A drop-in replacement for <input type="range"> with a fully custom, themeable track and thumb.
50

Current Volume: 50%

RAZOR
<TwSlider T="int" Id="volume-slider" Min="0" Max="100" Step="1" Label="Volume" @bind-Value="volumeValue" AriaLabel="Volume slider" />
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Current Volume: <strong>@volumeValue%</strong></p>
CSHARP
@code {
    private int volumeValue = 50;
}

Colors

Use Color to give a slider meaning at a glance - here it signals status rather than just decoration.
82

82% remaining

34

34% load

4

4 / 5 bars

RAZOR
<div class="space-y-6">
    <div>
        <TwSlider T="int" Id="battery-slider" Min="0" Max="100" Step="1" Label="Battery" Color="Color.Success" @bind-Value="batteryValue" AriaLabel="Battery level slider" />
        <p class="mt-2 text-sm text-gray-600 dark:text-gray-400">@batteryValue% remaining</p>
    </div>

    <div>
        <TwSlider T="int" Id="cpu-slider" Min="0" Max="100" Step="1" Label="CPU Usage" Color="Color.Danger" @bind-Value="cpuValue" AriaLabel="CPU usage slider" />
        <p class="mt-2 text-sm text-gray-600 dark:text-gray-400">@cpuValue% load</p>
    </div>

    <div>
        <TwSlider T="int" Id="signal-slider" Min="0" Max="5" Step="1" Label="Signal Strength" Color="Color.Accent" @bind-Value="signalValue" AriaLabel="Signal strength slider" />
        <p class="mt-2 text-sm text-gray-600 dark:text-gray-400">@signalValue / 5 bars</p>
    </div>
</div>
CSHARP
@code {
    private int batteryValue = 82;
    private int cpuValue = 34;
    private int signalValue = 4;
}

Precision & range

Any comparable numeric type works via T - use decimals with a fractional Step for fine control, or negative Min values for ranges that cross zero.
25.50

Selected Price: $25.50

20

Set to: 20°C

RAZOR
<div class="space-y-6">
    <div>
        <TwSlider T="decimal" Id="price-slider" Min="0m" Max="100m" Step="0.5m" Label="Price" @bind-Value="priceValue" AriaLabel="Price slider" />
        <p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Selected Price: <strong>@($"${priceValue:F2}")</strong></p>
    </div>

    <div>
        <TwSlider T="int" Id="temperature-slider" Min="-20" Max="40" Step="1" Label="Temperature" Color="Color.Accent" @bind-Value="temperatureValue" AriaLabel="Temperature slider" />
        <p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Set to: <strong>@temperatureValue&deg;C</strong></p>
    </div>
</div>
CSHARP
@code {
    private decimal priceValue = 25.50m;
    private int temperatureValue = 20;
}

Disabled & readonly

Disabled dims and locks the slider; ReadOnly keeps its color but blocks changes.
40
70
RAZOR
<div class="space-y-6">
    <TwSlider T="int" Id="disabled-slider" Min="0" Max="100" Step="1" Label="Disabled" @bind-Value="disabledValue" Disabled AriaLabel="Disabled slider" />
    <TwSlider T="int" Id="readonly-slider" Min="0" Max="100" Step="1" Label="Readonly" Color="Color.Danger" @bind-Value="readonlyValue" ReadOnly AriaLabel="Readonly slider" />
</div>
CSHARP
@code {
    private int disabledValue = 40;
    private int readonlyValue = 70;
}

Keyboard navigation

A slider is a native range input. A read-only slider can be focused but its value cannot be changed.
Key What it does
Tab Moves focus to the slider.
Arrow Right or Arrow Up Increases the value by one step.
Arrow Left or Arrow Down Decreases the value by one step.
Home or End Sets the minimum or maximum value.
Pg.Up or Pg.Down Changes the value by a larger amount.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwSliderTheme), configured via the AddTwBlazor() options callback described on the Get Started page. Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Property Type Controls
Wrapper string
Base string
Fill string
Track string
Thumb string
Bubble string

Global Theme Configuration

These reuse shared design tokens configured once on TwBlazorTheme, rather than being unique to this component.
Property Type Controls
Colors TwBlazorPalette

Full reference: TwSliderTheme on the API docs.

On this page

  • Basic usage
  • Colors
  • Precision & range
  • Disabled & readonly
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload