carbon-components-svelte/docs/src/pages/components/Slider.svx
metonym 1ccdf64504
feat(slider): add fullWidth prop (#1354)
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.
2022-06-18 12:47:10 -07:00

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 />