Wheel
<quiet-wheel>
name and placed inside a <form>.
Presents a scrollable wheel of options where the centered one is selected, with full native form integration. Use a wheel on touch-friendly forms when the options are ordered, such as quantities, sizes, or units.
A wheel always has a selection. When its value doesn't match an enabled option, the first enabled option is selected and the value is updated to match.
<fieldset id="wheel__overview">
<legend>Breakfast time</legend>
<div class="wheels">
<quiet-wheel label="Hour" name="hour" min="1" max="12" value="7" loop class="quiet-vh-label"></quiet-wheel>
<span class="separator">:</span>
<quiet-wheel label="Minute" name="minute" min="0" max="55" step="5" value="30" loop class="quiet-vh-label"></quiet-wheel>
<quiet-wheel label="AM or PM" name="period" value="am" class="quiet-vh-label">
<quiet-wheel-item value="am">AM</quiet-wheel-item>
<quiet-wheel-item value="pm">PM</quiet-wheel-item>
</quiet-wheel>
</div>
<p class="summary">Breakfast is served at <strong>7:30 AM</strong>.</p>
</fieldset>
<script>
const container = document.getElementById('wheel__overview');
const hourWheel = container.querySelector('quiet-wheel[name="hour"]');
const minuteWheel = container.querySelector('quiet-wheel[name="minute"]');
const periodWheel = container.querySelector('quiet-wheel[name="period"]');
const time = container.querySelector('.summary strong');
// Show minutes with a leading zero
customElements.whenDefined('quiet-wheel').then(() => {
minuteWheel.valueFormatter = value => String(value).padStart(2, '0');
});
// Update the summary when any wheel changes
container.addEventListener('quiet-change', () => {
time.textContent = `${hourWheel.value}:${minuteWheel.value.padStart(2, '0')} ${periodWheel.value.toUpperCase()}`;
});
</script>
<style>
#wheel__overview {
max-width: 20rem;
margin-block-end: 0;
.wheels {
display: flex;
align-items: center;
gap: 0.5rem;
}
quiet-wheel {
flex: 1 1 0;
}
.separator {
font-size: 1.25rem;
font-weight: var(--quiet-font-weight-semibold);
}
.summary {
margin-block: 1rem 0;
color: var(--quiet-text-muted);
}
}
</style>
Like other form controls, wheels fill the width of their container, so constrain them with
max-width or a layout. Generated labels that don't fit end in an ellipsis, and wheel item
content that doesn't fit is clipped at the end.
Examples Jump to heading
Providing options Jump to heading
Slot one or more wheel items into the wheel to provide its options. The selected item's
value is submitted with the form. Wheel items with the hidden attribute are left
out.
<quiet-wheel label="Breed" name="breed" value="maine-coon" style="max-width: 12rem;">
<quiet-wheel-item value="abyssinian">Abyssinian</quiet-wheel-item>
<quiet-wheel-item value="bengal">Bengal</quiet-wheel-item>
<quiet-wheel-item value="maine-coon">Maine Coon</quiet-wheel-item>
<quiet-wheel-item value="persian">Persian</quiet-wheel-item>
<quiet-wheel-item value="siamese">Siamese</quiet-wheel-item>
<quiet-wheel-item value="sphynx">Sphynx</quiet-wheel-item>
</quiet-wheel>
Labels and descriptions Jump to heading
You can use the label and description attributes to provide plain text labels and
descriptions for the wheel. If you want to provide HTML, use the label and
description slots instead.
<quiet-wheel label="Coat length" name="coat" value="medium" style="max-width: 12rem;">
<span slot="description">
Not sure? <a href="https://example.com/" target="_blank">Ask the vet</a>.
</span>
<quiet-wheel-item value="hairless">Hairless</quiet-wheel-item>
<quiet-wheel-item value="short">Short</quiet-wheel-item>
<quiet-wheel-item value="medium">Medium</quiet-wheel-item>
<quiet-wheel-item value="long">Long</quiet-wheel-item>
<quiet-wheel-item value="extra-long">Extra long</quiet-wheel-item>
</quiet-wheel>
Hiding labels Jump to heading
Wheels are often grouped, so a heading, a legend, or the neighboring wheels already tell the user what each
one is for. In that case, add the quiet-vh-label class from the
CSS utilities to hide each wheel's label
visually. Each wheel is still a separate form control with its own name and value.
<fieldset id="wheel__hiding-labels">
<legend>Nap length</legend>
<div class="wheels">
<quiet-wheel label="Hours" name="hours" min="0" max="12" value="2" class="quiet-vh-label"></quiet-wheel>
<span>hr</span>
<quiet-wheel label="Minutes" name="minutes" min="0" max="55" step="5" value="30" loop class="quiet-vh-label"></quiet-wheel>
<span>min</span>
</div>
</fieldset>
<style>
#wheel__hiding-labels {
max-width: 18rem;
margin-block-end: 0;
.wheels {
display: flex;
align-items: center;
gap: 0.5rem;
}
quiet-wheel {
flex: 1 1 0;
}
span {
color: var(--quiet-text-muted);
}
}
</style>
Always provide a label, even when it's hidden. The label won't be displayed, but it will be announced by assistive devices, which can't rely on the layout to tell the wheels apart.
Providing an initial value Jump to heading
Use the value attribute to provide an initial value for the wheel. The value should match a
wheel item's value or one of the generated numbers.
<quiet-wheel label="Fur color" name="color" value="orange" style="max-width: 12rem;">
<quiet-wheel-item value="black">Black</quiet-wheel-item>
<quiet-wheel-item value="white">White</quiet-wheel-item>
<quiet-wheel-item value="orange">Orange</quiet-wheel-item>
<quiet-wheel-item value="gray">Gray</quiet-wheel-item>
<quiet-wheel-item value="calico">Calico</quiet-wheel-item>
</quiet-wheel>
Generating numbers Jump to heading
To offer a range of numbers without writing an item for each one, leave out the wheel items and set the
min and max attributes. Use the step attribute to change the interval
between numbers, with the default being 1.
<quiet-wheel label="Treats" name="treats" min="0" max="10" value="2" style="max-width: 8rem;"></quiet-wheel>
<quiet-wheel label="Scoops" name="scoops" min="0.5" max="3" step="0.5" value="1.5" style="max-width: 8rem;"></quiet-wheel>
The value is always a string, so selecting 1.5 sets the value to "1.5". A wheel
shows either wheel items or generated numbers, never both. When it has wheel items, min,
max, and step are ignored.
Wheels work best with up to a few hundred options. Beyond that, scrolling to a value gets tedious and the wheel takes longer to render. Consider using a number input for larger ranges.
Formatting numbers Jump to heading
Generated numbers are formatted for the page's locale by default. To change their labels, set the
valueFormatter property to a function that accepts a number and returns a string. The
API works well for this.
<quiet-wheel
id="wheel__formatting"
label="Weight"
name="weight"
min="2"
max="10"
step="0.5"
value="4.5"
style="max-width: 12rem;"
></quiet-wheel>
<script>
const wheel = document.getElementById('wheel__formatting');
const formatter = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'kilogram' });
customElements.whenDefined('quiet-wheel').then(() => {
wheel.valueFormatter = value => formatter.format(value);
});
</script>
Only the labels change, so the value is still the number. Typing digits matches either one, so typing
1500 finds a row labeled "1,500".
Looping Jump to heading
Add the loop attribute to let generated numbers wrap around from the last one back to the
first.
<quiet-wheel label="Grooming day" name="day" min="1" max="31" value="1" loop style="max-width: 8rem;"></quiet-wheel>
Only generated numbers can loop, so wheels with slotted items always stop at the ends. Short ranges stop at the ends too, since a wheel needs at least two more numbers than visible rows to loop.
Adding HTML content Jump to heading
Wheel items accept HTML, so an option can show more than a name. The item's text is used for typeahead and
announced by assistive devices. When an item has no text of its own or it should read differently, set the
label attribute.
<quiet-wheel label="Portion" name="portion" value="medium" style="max-width: 12rem;">
<quiet-wheel-item value="snack">
Snack <small>โ
cup</small>
</quiet-wheel-item>
<quiet-wheel-item value="small">
Small <small>ยผ cup</small>
</quiet-wheel-item>
<quiet-wheel-item value="medium">
Medium <small>โ
cup</small>
</quiet-wheel-item>
<quiet-wheel-item value="large">
Large <small>ยฝ cup</small>
</quiet-wheel-item>
<quiet-wheel-item value="feast">
Feast <small>ยพ cup</small>
</quiet-wheel-item>
</quiet-wheel>
Items can hold other components and more than one line. Use the --row-height custom property to
make room, and set label so the wheel announces a short name instead of everything in the row.
<quiet-wheel id="wheel__people" label="Assign to" name="assignee" value="pawdrick">
<quiet-wheel-item value="meowy" label="Meowy McGee">
<quiet-avatar image="https://images.unsplash.com/photo-1672487209629-4d52e0c043d0?q=80&w=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"></quiet-avatar>
<div>
Meowy McGee
<small>Chief Napping Officer</small>
</div>
</quiet-wheel-item>
<quiet-wheel-item value="whiskers" label="Lady Whiskers">
<quiet-avatar image="https://images.unsplash.com/photo-1516310789627-2ff305829fbb?q=80&w=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"></quiet-avatar>
<div>
Lady Whiskers
<small>Head of Treat Procurement</small>
</div>
</quiet-wheel-item>
<quiet-wheel-item value="pawdrick" label="Pawdrick Swayze">
<quiet-avatar image="https://images.unsplash.com/photo-1569591159212-b02ea8a9f239?q=80&w=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"></quiet-avatar>
<div>
Pawdrick Swayze
<small>Director of Zoomies</small>
</div>
</quiet-wheel-item>
<quiet-wheel-item value="mittens" label="Sir Mittens">
<quiet-avatar image="https://images.unsplash.com/photo-1529778873920-4da4926a72c2?q=80&w=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"></quiet-avatar>
<div>
Sir Mittens
<small>Senior Box Inspector</small>
</div>
</quiet-wheel-item>
<quiet-wheel-item value="sunny" label="Sunny Purrkins">
<quiet-avatar image="https://images.unsplash.com/photo-1526336024174-e58f5cdd8e13?q=80&w=256&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"></quiet-avatar>
<div>
Sunny Purrkins
<small>Sunbeam Analyst</small>
</div>
</quiet-wheel-item>
</quiet-wheel>
<style>
#wheel__people {
--row-height: 3.5em;
max-width: 18rem;
quiet-wheel-item {
justify-content: start;
gap: 0.75em;
line-height: 1.3;
}
quiet-avatar {
--size: 2.25em;
}
small {
display: block;
}
}
</style>
Disabling items Jump to heading
Add the disabled attribute to a wheel item to prevent it from being selected. The keyboard
skips disabled items, and when scrolling stops on one, the wheel moves to the nearest enabled item.
<quiet-wheel label="Litter" name="litter" value="pine" style="max-width: 12rem;">
<quiet-wheel-item value="clay">Clay</quiet-wheel-item>
<quiet-wheel-item value="crystal" disabled>Crystal (sold out)</quiet-wheel-item>
<quiet-wheel-item value="pine">Pine</quiet-wheel-item>
<quiet-wheel-item value="paper">Paper</quiet-wheel-item>
<quiet-wheel-item value="corn" disabled>Corn (sold out)</quiet-wheel-item>
<quiet-wheel-item value="wheat">Wheat</quiet-wheel-item>
</quiet-wheel>
Changing the number of rows Jump to heading
By default, wheels show five rows. To change it, set the --visible-rows custom property. Use an
odd number so whole rows show above and below the selection. You can also change the height of each row with
the --row-height custom property.
<quiet-wheel label="Three rows" min="1" max="9" value="5" style="max-width: 8rem; --visible-rows: 3;"></quiet-wheel>
<quiet-wheel label="Seven rows" min="1" max="9" value="5" style="max-width: 8rem; --visible-rows: 7; --row-height: 1.75em;"></quiet-wheel>
Changing the size Jump to heading
Use the size attribute to change the wheel's size.
<quiet-wheel label="XS" size="xs" min="1" max="9" value="5" style="max-width: 5em;"></quiet-wheel>
<quiet-wheel label="SM" size="sm" min="1" max="9" value="5" style="max-width: 5em;"></quiet-wheel>
<quiet-wheel label="MD" size="md" min="1" max="9" value="5" style="max-width: 5em;"></quiet-wheel>
<quiet-wheel label="LG" size="lg" min="1" max="9" value="5" style="max-width: 5em;"></quiet-wheel>
<quiet-wheel label="XL" size="xl" min="1" max="9" value="5" style="max-width: 5em;"></quiet-wheel>
Disabling Jump to heading
Use the disabled attribute to disable the wheel.
<quiet-wheel label="Lives remaining" min="1" max="9" value="7" disabled style="max-width: 8rem;"></quiet-wheel>
Read-only Jump to heading
Use the readonly attribute to make the wheel read-only. It can still receive focus, but the
user can't change the value.
<quiet-wheel label="Lives remaining" min="1" max="9" value="7" readonly style="max-width: 8rem;"></quiet-wheel>
Validation Jump to heading
The required attribute can be applied to enable validation using the
Constraint Validation
. This will prevent form submission until an option with a non-empty value is selected. Since a wheel
always has a selection, make the first item's value empty so the user has to choose.
<form action="about:blank" method="get" target="_blank">
<quiet-wheel label="Adopt a cat" name="cat" required style="max-width: 12rem;">
<quiet-wheel-item value="">Choose one</quiet-wheel-item>
<quiet-wheel-item value="mittens">Mittens</quiet-wheel-item>
<quiet-wheel-item value="shadow">Shadow</quiet-wheel-item>
<quiet-wheel-item value="luna">Luna</quiet-wheel-item>
</quiet-wheel>
<br>
<quiet-button type="submit" variant="primary">Submit</quiet-button>
<quiet-button type="reset">Reset</quiet-button>
</form>
Using custom validation Jump to heading
Use the setCustomValidity() method to make the wheel invalid and show a custom error message on
submit. This will override all other validation parameters. To clear the error, call the method again with
an empty string.
<form action="about:blank" method="get" target="_blank" id="wheel__custom-validation">
<quiet-wheel
label="Treats"
description="This field will be invalid until custom validation is removed"
name="treats"
min="0"
max="10"
value="2"
style="max-width: 16rem;"
></quiet-wheel>
<br>
<quiet-button type="submit" variant="primary">Submit</quiet-button>
</form>
<script type="module">
import { allDefined } from '/dist/quiet.js';
await allDefined();
const form = document.getElementById('wheel__custom-validation');
const wheel = form.querySelector('quiet-wheel');
wheel.setCustomValidity('Not so fast, bubba!');
</script>
Styling validation Jump to heading
You can style valid and invalid wheels using the user-valid and user-invalid
custom states. These styles are only shown after the user interacts
with the form control or when the form is submitted. The :valid and
:invalid pseudo classes are also available, but they match even before the user has had a
chance to fill out the form.
<form action="about:blank" method="get" target="_blank" class="wheel__validation-custom">
<quiet-wheel label="Adopt a cat" name="cat" required style="max-width: 12rem;">
<quiet-wheel-item value="">Choose one</quiet-wheel-item>
<quiet-wheel-item value="mittens">Mittens</quiet-wheel-item>
<quiet-wheel-item value="shadow">Shadow</quiet-wheel-item>
<quiet-wheel-item value="luna">Luna</quiet-wheel-item>
</quiet-wheel>
<br>
<quiet-button type="submit" variant="primary">Submit</quiet-button>
<quiet-button type="reset">Reset</quiet-button>
</form>
<style>
.wheel__validation-custom {
quiet-wheel:state(user-valid) {
outline: solid 2px var(--quiet-constructive-stroke-mid);
outline-offset: .5rem;
}
quiet-wheel:state(user-invalid) {
outline: solid 2px var(--quiet-destructive-stroke-mid);
outline-offset: .5rem;
}
}
</style>
If you're using the CSS utilities, add the
quiet-user-valid and quiet-user-invalid classes to any form control for
automatic validation styling.
Styling wheels Jump to heading
Wheels come with a simple, minimal appearance. Feel free to customize them with your own styles. Here's a nap timer that restyles the selection band and the edge fade.
<div id="wheel__styling">
<quiet-wheel label="Minutes" name="minutes" min="0" max="59" value="20" loop></quiet-wheel>
<span aria-hidden="true">:</span>
<quiet-wheel label="Seconds" name="seconds" min="0" max="59" value="0" loop></quiet-wheel>
</div>
<script>
const container = document.getElementById('wheel__styling');
customElements.whenDefined('quiet-wheel').then(() => {
container.querySelectorAll('quiet-wheel').forEach(wheel => {
wheel.valueFormatter = value => String(value).padStart(2, '0');
});
});
</script>
<style>
#wheel__styling {
--timer-background: #1c1917;
--timer-accent: #fbbf24;
display: flex;
align-items: end;
justify-content: center;
gap: 0.75rem;
width: fit-content;
padding: 1.25rem 1.75rem;
border-radius: 1.5rem;
background-color: var(--timer-background);
color: #fafaf9;
quiet-wheel {
--row-height: 1.5em;
--visible-rows: 3;
width: 6rem;
}
/* Small, centered captions */
quiet-wheel::part(label) {
display: block;
max-width: none;
color: var(--timer-accent);
font-size: 0.75rem;
font-weight: var(--quiet-font-weight-semibold);
letter-spacing: 0.1em;
text-align: center;
text-transform: uppercase;
}
/* Remove the box and set the digits */
quiet-wheel::part(wheel) {
border: none;
background: none;
font-family: var(--quiet-font-family-code);
font-size: 3rem;
font-weight: var(--quiet-font-weight-semibold);
}
/* Give the digits the full width */
quiet-wheel::part(item) {
padding-inline: 0;
}
/* Turn the selection band into two rules */
quiet-wheel::part(wheel)::before {
inset-inline: 0;
border-block: solid 2px var(--timer-accent);
border-radius: 0;
background: none;
}
/* Fade to the timer's background */
quiet-wheel::part(wheel)::after {
background-image: linear-gradient(
var(--timer-background),
transparent 35%,
transparent 65%,
var(--timer-background)
);
}
> span {
font-family: var(--quiet-font-family-code);
font-size: 3rem;
font-weight: var(--quiet-font-weight-semibold);
line-height: 4.5rem;
margin-block-end: 4.5rem;
}
}
</style>
Keyboard support Jump to heading
Tab to the wheel to focus it, then use the keys below.
| Key | Action |
|---|---|
| โ | Selects the next option (wraps when looping) |
| โ | Selects the previous option (wraps when looping) |
| Page Down | Moves the selection down by the number of visible rows |
| Page Up | Moves the selection up by the number of visible rows |
| Home | Selects the first option |
| End | Selects the last option |
| Type a character | Selects the next option that starts with the typed characters |
| Enter | Submits the associated form |
API Jump to heading
Importing Jump to heading
The autoloader is the recommended way to import components but, if you prefer to do it manually, the following code snippets will be helpful.
To manually import <quiet-wheel> from the CDN, use the following code.
import 'https://cdn.quietui.org/v6.7.0/components/wheel/wheel.js';
To manually import <quiet-wheel> from a self-hosted distribution, use the following
code. Remember to replace /path/to/quiet with the appropriate local path.
import '/path/to/quiet/components/wheel/wheel.js';
Slots Jump to heading
Wheel supports the following slots. Learn more about using slots
| Name | Description |
|---|---|
| (default) |
The wheel items to choose from. Hidden items are left out. When nothing is slotted, rows are
generated from min, max, and step.
|
label
|
The wheel's label. For plain-text labels, you can use the label attribute instead.
|
description
|
The wheel's description. For plain-text descriptions, you can use the
description attribute instead.
|
Properties Jump to heading
Wheel has the following properties that can be set with corresponding attributes. In many cases, the attribute's name is the same as the property's name. If an attribute is different, it will be displayed after the property. Learn more about attributes and properties
| Property | Description | Reflects | Type | Default |
|---|---|---|---|---|
label
|
The wheel's label. If you need to provide HTML in the label, use the label slot
instead.
|
|
string
|
|
description
|
The wheel's description. If you need to provide HTML in the description, use the
description slot instead.
|
|
string
|
|
name
|
The name of the wheel. This will be submitted with the form as a name/value pair. |
|
string
|
|
value
|
The value of the selected option. When it doesn't match an enabled option, the first enabled option
is selected and the value is updated to match. Numbers are converted to strings, so
wheel.value = 5 selects the generated option "5".
|
|
string
|
''
|
disabled
|
Disables the wheel. |
|
boolean
|
false
|
readonly
|
Makes the wheel read-only. It can still receive focus, but the value can't be changed. |
|
boolean
|
false
|
required
|
Makes the wheel required. Form submission won't be allowed when the selected value is empty. |
|
boolean
|
false
|
loop
|
Lets the wheel loop from the last option back to the first. Only generated rows loop, and only when there are at least two more of them than the wheel shows. Slotted wheel items never loop. |
|
boolean
|
false
|
size
|
The wheel's size. |
|
'xs' |
'sm' |
'md' |
'lg' |
'xl'
|
'md'
|
min
|
The first generated value. Rows are only generated when min and max are
set and no wheel items are slotted.
|
|
number
|
|
max
|
The last generated value. Rows are only generated when min and max are set
and no wheel items are slotted.
|
|
number
|
|
step
|
The interval between generated values. |
|
number
|
1
|
valueFormatter
|
A custom formatting function for the labels of generated rows. The function will receive the number and must return a string. This is a property, not an attribute. |
|
(value: number) => string
|
|
form
|
The form to associate this control with. If omitted, the closest containing
<form> will be used. The value of this attribute must be an ID of a form in the
same document or shadow root.
|
|
string
|
Methods Jump to heading
Wheel supports the following methods. You can obtain a reference to the element and call them like functions in JavaScript. Learn more about methods
| Name | Description | Arguments |
|---|---|---|
focus() |
Sets focus to the wheel. |
options: FocusOptions
|
blur() |
Removes focus from the wheel. | |
stepUp() |
Selects the next enabled option, wrapping only when the wheel loops. This is a programmatic change,
so input and change events will not be emitted when this is called.
|
|
stepDown() |
Selects the previous enabled option, wrapping only when the wheel loops. This is a programmatic
change, so input and change events will not be emitted when this is
called.
|
|
checkValidity() |
Checks if the form control has any restraints and whether it satisfies them. If invalid,
false will be returned and the invalid event will be dispatched. If valid,
true will be returned.
|
|
reportValidity() |
Checks if the form control has any restraints and whether it satisfies them. If invalid,
false will be returned and the invalid event will be dispatched. In
addition, the problem will be reported to the user. If valid, true will be returned.
|
|
setCustomValidity()
|
Sets a custom validation message for the form control. If this message is not an empty string, then the form control is considered invalid and the specified message will be displayed to the user when reporting validity. Setting an empty string clears the custom validity state. | message: string |
Events Jump to heading
Wheel dispatches the following custom events. You can listen to them the same way was native events. Learn more about custom events
| Name | Description |
|---|---|
quiet-blur |
Emitted when the wheel loses focus. This event does not bubble. |
quiet-change |
Emitted when the user commits changes to the wheel's value. |
quiet-focus |
Emitted when the wheel receives focus. This event does not bubble. |
quiet-input |
Emitted when the wheel receives input. |
CSS custom properties Jump to heading
Wheel supports the following CSS custom properties. You can style them like any other CSS property. Learn more about CSS custom properties
| Name | Description | Default |
|---|---|---|
--visible-rows |
The number of rows the wheel shows. Use an odd number so whole rows show above and below the selection. |
5
|
--row-height |
The height of each row. |
2.25em
|
CSS parts Jump to heading
Wheel exposes internal elements that can be styled with CSS using the selectors shown below. Learn more about CSS parts
| Name | Description | CSS selector |
|---|---|---|
label |
The element that contains the wheel's label. |
::part(label)
|
description |
The element that contains the wheel's description. |
::part(description)
|
wheel |
The element that wraps the items and draws the selection band, the edge fade, and the focus ring. |
::part(wheel)
|
items |
The scroll container that holds the items. This is the focusable element. |
::part(items)
|
item |
A generated row. Only rendered when no wheel items are slotted. |
::part(item)
|
item-selected |
The selected generated row. |
::part(item-selected)
|
Custom States Jump to heading
Wheel has the following custom states. You can target them with CSS using the selectors shown below. Learn more about custom states
| Name | Description | CSS selector |
|---|---|---|
disabled |
Applied when the wheel is disabled. |
:state(disabled)
|
blank |
Applied when the selected value is empty. |
:state(blank)
|
focused |
Applied when the wheel has focus. |
:state(focused)
|
user-valid |
Applied when the wheel is valid and the user has sufficiently interacted with it. |
:state(user-valid)
|
user-invalid |
Applied when the wheel is invalid and the user has sufficiently interacted with it. |
:state(user-invalid)
|
Dependencies Jump to heading
Wheel automatically imports the following elements. Sub-dependencies are also included in this list.