mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 19:21:26 +00:00
The `bx--slider` class in the `Slider` component has max-width of `40rem`. Because `$$restProps` is spread to the top-level `div` element in `Slider`, the only way to override the style is to do so globally: ```css :global(.bx--slider-container) { width: 100%; } :global(.bx--slider) { max-width: none; } ``` This adds a `fullWidth` prop that sets a full width style using inline style attributes.
50 lines
No EOL
1.1 KiB
Text
50 lines
No EOL
1.1 KiB
Text
---
|
|
components: ["Slider", "SliderSkeleton"]
|
|
---
|
|
|
|
<script>
|
|
import { Slider, SliderSkeleton } from "carbon-components-svelte";
|
|
import Preview from "../../components/Preview.svelte";
|
|
</script>
|
|
|
|
### Default
|
|
|
|
<Slider />
|
|
|
|
### Full width
|
|
|
|
Set `fullWidth` to `true` for the slider to span the full width of its containing element.
|
|
|
|
<Slider fullWidth />
|
|
|
|
### Hidden text input
|
|
|
|
<Slider hideTextInput />
|
|
|
|
### Custom minimum, maximum values
|
|
|
|
<Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} />
|
|
|
|
### Custom step value
|
|
|
|
<Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
|
|
|
|
### Light variant
|
|
|
|
<Slider light labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
|
|
|
|
### Invalid state
|
|
|
|
<Slider invalid labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
|
|
|
|
### Disabled state
|
|
|
|
<Slider disabled labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
|
|
|
|
### Skeleton
|
|
|
|
<SliderSkeleton />
|
|
|
|
### Skeleton (hidden label)
|
|
|
|
<SliderSkeleton hideLabel /> |