Form
Date Time Field
A date and time field built on the native datetime-local input, with a time zone select beside it.
- Element
<slab-date-time-field>- Built on
<input type=datetime-local>
Example
Here's a styled version, <slab-styled-date-time-field>. It's not
in the package — it's an example of what you can build with the
headless element. Copy it and make it yours at the
bottom of this page. Switch to "As it ships" to see the same markup
with the headless element and no CSS at all. That's your starting
point. Open either one in StackBlitz to change it and watch it run.
<slab-styled-date-time-field label="Pour starts" min="2026-11-30T06:00" time-zone="America/Chicago" time-zones="America/New_York America/Chicago America/Denver America/Los_Angeles" value="2026-12-02T07:30">
<span slot="description">In the job site's time zone. Trucks leave the plant an hour before.</span>
</slab-styled-date-time-field>
<slab-date-time-field label="Pour starts" min="2026-11-30T06:00" time-zone="America/Chicago" time-zones="America/New_York America/Chicago America/Denver America/Los_Angeles" value="2026-12-02T07:30">
<span slot="description">In the job site's time zone. Trucks leave the plant an hour before.</span>
</slab-date-time-field>
Usage
pnpm add slab-elements lit
import 'slab-elements/date-time-field.js';
export function MyDateTimeField() {
return (
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
);
}
MyDateTimeField.jsx React 19 or later, which sets props on custom elements as properties.
import 'slab-elements/date-time-field.js';
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
@customElement('my-date-time-field')
export class MyDateTimeField extends LitElement {
render() {
return html`
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
`;
}
}
my-date-time-field.ts Slab is built on Lit, so its elements are at home in Lit's templates.
<script setup>
import 'slab-elements/date-time-field.js';
</script>
<template>
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
</template>
MyDateTimeField.vue Let Vue's compiler know slab- tags are custom elements with isCustomElement.
<script>
import 'slab-elements/date-time-field.js';
</script>
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
MyDateTimeField.svelte Svelte binds properties and events to custom elements like any other element.
import 'slab-elements/date-time-field.js';
export const MyDateTimeField = <template>
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
</template>;
MyDateTimeField.gjs Ember sets attributes, and a dynamic value like {{this.max}} sets the property when the element has one. {{on}} listens for any event by its name.
<script type="module">
import 'slab-elements/date-time-field.js';
</script>
<slab-date-time-field label="Starts" name="starts" time-zone-name="starts-time-zone" required></slab-date-time-field>
index.html Any bundler (or an import map) takes care of the imports.
Value and time zone
The value is a native datetime-local input’s: a “yyyy-mm-ddThh:mm” time on a wall clock, such as “2026-12-02T07:30”, with no offset. The time zone says whose wall clock it is. It’s an IANA name, such as “America/Chicago”, and the browser’s own unless time-zone sets another. The person can change it from the select beside the input.
<form>
<slab-date-time-field
label="Starts"
name="starts"
time-zone="America/Chicago"
time-zone-name="starts-time-zone"
value="2026-12-02T07:30"
></slab-date-time-field>
</form>
That form submits starts=2026-12-02T07:30 and starts-time-zone=America/Chicago, as an input and a select with those names would, so a server gets both without parsing an offset. Without time-zone-name, only the value is submitted.
Changing the time zone keeps the value, so 07:30 stays 07:30 and is a different moment. valueAsDate is that moment as a Date, and setting it writes the Date’s wall-clock time in the field’s time zone. A native datetime-local input’s valueAsDate is always null, since it has no time zone. When clocks go back and a time happens twice, it’s the earlier one, and when they go forward and a time never happens, it’s moved forward by the gap.
const field = document.querySelector('slab-date-time-field');
field.valueAsDate.toISOString(); // "2026-12-02T13:30:00.000Z"
field.timeZone = 'America/New_York';
field.valueAsDate.toISOString(); // "2026-12-02T12:30:00.000Z"
The select lists every time zone the browser knows, or only the ones in time-zones, as space-separated names. Each shows its offset from UTC at the value’s date, such as “America/Chicago (GMT-6)”, in the language of the nearest lang. The current time zone is always listed, and one the browser doesn’t know falls back to the browser’s own. The select is named by the field’s label and then by its own, “Time zone”, which time-zone-label or registerStrings()’s dateTimeFieldTimeZone changes.
min, max and step are the input’s, and are wall-clock times too. A read-only field’s select is disabled, since a native select has no readonly, and its time zone is still submitted.
Keyboard
| Key | What it does |
|---|---|
| Tab | Moves through the input’s date and time, then to the select. |
| Up, Down | Steps the focused part of the date or time. |
| Enter | Submits the field’s form. |
Behavior
A date and time field with no visual styles, around a native <input type="datetime-local">, so it is typed into, picked from, and read the way one is, with a native <select> of time zones beside it. Any picker is the browser's own.
The value is the input's: a "yyyy-mm-ddThh:mm" string, with ":ss" and ".sss" when it has them, or an empty one. It's a time on a wall clock, as a native input's is, and the time zone says whose wall clock. What a person sees is formatted for their locale by the browser, but what's submitted and read is always that one format.
The time zone is an IANA name, such as "America/New_York". It's the browser's own unless time-zone says otherwise, and the person can change it from the select, which lists every time zone the browser knows, or only those in time-zones. Each is shown with its offset from UTC at the value's date, or at today's when there's no value. Changing it dispatches "input" and "change", as a native select does, and leaves the value alone, so 09:30 stays 09:30 and is a different moment.
The value is submitted under name, as a native input's is, and the time zone under time-zone-name, as a native select's would be, so a server gets both without parsing either. valueAsDate is the moment they mean together, which a native datetime-local input has no way to say.
The label and the input are both in the shadow root, so a plain for reference names it without crossing out of one. The select is named by the label and then by its own, "Time zone" unless time-zone-label is set. The host delegates focus, so clicking anywhere on it, or a <label for> pointing at it, focuses the input.
Validity is the native input's. required, min, max and step are passed through to it, and whatever it decides is mirrored onto the host, so valueMissing, rangeUnderflow, rangeOverflow, stepMismatch and badInput all mean what they mean on an <input>. Like the value, min and max are wall-clock times in the field's time zone. Nothing is computed twice.
Style it through its parts and through :state(disabled), :state(error), :state(readonly) and :state(required). Where the label sits relative to the input, and the select relative to both, is layout, so it's left to the styles around it.
API
<slab-date-time-field>
| Name | Type | Default | Description |
|---|---|---|---|
label
Required
|
string |
Names it. It's the accessible name, and the visible label where there is one. | |
autocomplete
|
HTMLInputElement['autocomplete'] |
What the browser may fill it with, as a native input's autocomplete says. |
|
disabled
|
boolean |
false |
Disables it, as disabled does a native control: the user can't focus or use it, and a form control's value isn't submitted. |
hide-label
|
boolean |
false |
Hides the label visually and leaves it as the accessible name, for a design that shows the label some other way. |
max
|
string |
The latest date and time allowed, as "yyyy-mm-ddThh:mm". | |
min
|
string |
The earliest date and time allowed, as "yyyy-mm-ddThh:mm". Also where step counts from. |
|
name
|
string |
'' |
The name its value is submitted under, as a native control's name. |
readonly
|
boolean |
false |
Lets the user select the value but not change it, as readonly does a native input. The value is still submitted. |
required
|
boolean |
false |
Makes it invalid while it has no value, as required does a native control. |
step
|
string |
In seconds, or "any". 60 when unset, so there's no seconds to fill in. Counted from min when there is one. |
|
time-zone
|
string |
An IANA time zone name, such as "America/New_York". The browser's own when unset, and when it's a time zone the browser doesn't know. Like value, the attribute is the default and the property is the current one, so the attribute doesn't change as the person picks another. |
|
time-zone-label
|
string |
The select's label, and so its accessible name along with label. "Time zone" in English when unset. |
|
time-zone-name
|
string |
The name the time zone is submitted under. It isn't submitted when unset, as a native select without a name isn't. |
|
time-zones
|
string |
The time zones to choose from, as space-separated IANA names, in the order they're listed. Every time zone the browser knows when unset. The current one is always listed, even when it isn't one of these. | |
value
|
string |
'' |
A "yyyy-mm-ddThh:mm" string, with ":ss" and ".sss" when it has them. Like a native input, the attribute is the default value and the property is the current one, so the attribute doesn't change as the field is edited. |
custom-validity
|
string |
Makes it invalid with this message, as setCustomValidity() does, and shows the message at once rather than once validity is reported, for an error the page already knows about, such as one from a server. Removing it, or setting it to an empty string, makes it valid again, unless something else makes it invalid. |
| Name | Type | Description |
|---|---|---|
defaultValue
|
string |
The value it starts with, and goes back to when its form resets. It's the value attribute, as a native input's defaultValue is, so setting it sets the attribute, and value with it. |
form
Read-only
|
HTMLFormElement | null |
The form it belongs to, or null. |
labels
Read-only
|
NodeList |
The <label> elements associated with it, as a native control's labels: each <label for> that names its id, and a <label> around it. |
validationMessage
Read-only
|
string |
What's wrong, as the validity message says it: the message given to setCustomValidity() or setValidity(), or else the browser's own. Empty while it's valid. |
validity
Read-only
|
ValidityState |
Its ValidityState, as a native control's. |
willValidate
Read-only
|
boolean |
Whether its validity is checked when its form submits. It isn't while it's disabled or read-only. |
valueAsDate
|
Date | null |
The moment value is in timeZone, as a Date, or null when empty. A native datetime-local input's is always null, since it has no time zone. A time that happens twice, when clocks go back, is the earlier one, and a time that never happens, when they go forward, is moved forward by the gap. Setting it sets value to the Date's wall-clock time in timeZone. |
| Signature | Description |
|---|---|
checkValidity(): boolean
|
Whether its value is valid. Dispatches "invalid" when it isn't, as a native control's does. |
click(): void
|
Clicks it, as a native element's click() does. |
focus(options?: FocusOptions): void
|
Focuses it, or the part of it that takes focus. |
reportValidity(): boolean
|
Whether its value is valid. When it isn't, dispatches "invalid" and shows the validity message, as a native control's does. |
resetValidityFeedback(): void
|
Clears the validity feedback without changing validity. |
setCustomValidity(message: string): void
|
Makes it invalid with a message of your own, or valid again with an empty one, as a native control's does. |
setValidity(flags?: ValidityStateFlags, message?: string): void
|
Sets its validity and message, as ElementInternals.setValidity() does, for checks of your own beyond setCustomValidity(). |
showPicker(): void
|
Opens the browser's date and time picker, where it has one. It's the native input's, so it throws where that one does, such as without a user gesture. |
| Name | Type | Description |
|---|---|---|
input
|
Event |
As the user changes its value or its time zone, as a native control's does. Setting either from code doesn't dispatch it. |
change
|
Event |
When the user changes its value or its time zone, as a native control's does. Setting either from code doesn't dispatch it. |
invalid
|
Event |
When a check finds its value invalid, as a native control's does. Cancel it to leave the validity message unshown, after a blur, a submit or reportValidity(), and focus where it is. |
| Name | Type | Description |
|---|---|---|
description
|
Element | string |
Text that describes it, such as a hint or what the validity message means. It's its accessible description. |
validity-message
|
Element | string |
Shown in place of the validity message's text while it's invalid and the message shows, for wording of your own, a translation, or a link. It's part of its accessible description, and validationMessage stays the browser's or setCustomValidity()'s. |
| Name | Description |
|---|---|
description
|
Text about the field, and its validity message when it has one |
fields
|
The input, and the select with its label |
input
|
The input |
label
|
The label |
time-zone
|
The time zone select |
time-zone-field
|
The select and its label |
time-zone-label
|
The select's label |
validity-message
|
The validity message, which says why the value is invalid |
| Name | Description |
|---|---|
:state(disabled)
|
While it's disabled. |
:state(error)
|
While it's invalid and its validity message shows, which is once its validity is reported, as when its form is submitted. |
:state(readonly)
|
While it's read-only. |
:state(required)
|
While it's required, for styles such as an asterisk. |
Copy and own it
<slab-styled-date-time-field> isn't in the package. It's an example —
copy it into your project and change whatever you want. Keyboard,
focus, ARIA, forms, and events all come from the headless element,
and the styles only reach in through ::part() and
:state(), same as yours would.
The same styles, written from outside the element, so
there's nothing to subclass. The CSS styles every
<slab-date-time-field> on the page. Import
tokens.css, the colors and fonts every styled
example shares, once, wherever your global styles go.
Each component registers its headless element and imports its CSS. Use it like the element: its props are the element's attributes and properties.
DateTimeField.jsx
import 'slab-elements/date-time-field.js';
import './date-time-field.css';
export function DateTimeField(props) {
return <slab-date-time-field {...props} />;
}
date-time-field.css
slab-date-time-field {
color: var(--ink);
display: grid;
font-family: var(--font-body);
}
slab-date-time-field::part(label) {
font-family: var(--font-display);
font-size: 1.0625rem;
font-weight: 600;
margin-block-end: 0.375rem;
}
slab-date-time-field:state(required)::part(label)::after {
color: var(--ember-deep);
content: ' *' / '';
}
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
background-color: var(--paper);
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
font: inherit;
/* A fixed height, shared with Select, so fields line up in a row. */
padding: 0 0.75rem;
transition:
background-color 100ms,
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(input)::placeholder,
slab-date-time-field::part(textarea)::placeholder {
color: var(--ash);
}
/*
The outline is transparent rather than gone, so it still shows in forced
colors, where box shadows don't.
*/
slab-date-time-field::part(input):focus-visible,
slab-date-time-field::part(textarea):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(input):disabled,
slab-date-time-field::part(textarea):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field::part(textarea) {
block-size: auto;
min-block-size: 7rem;
padding: 0.625rem 0.75rem;
resize: vertical;
}
slab-date-time-field:state(readonly)::part(input),
slab-date-time-field:state(readonly)::part(textarea) {
background-color: var(--chalk);
}
slab-date-time-field:state(error)::part(input),
slab-date-time-field:state(error)::part(textarea) {
border-color: var(--ember-deep);
}
/*
Spaced by what's in it rather than by a gap, so a description with
nothing in it takes no room, and a control beside the field lines up
with its bottom edge.
*/
slab-date-time-field::part(description) {
color: var(--ash);
display: grid;
font-size: 0.875rem;
}
slab-date-time-field > [slot='description'] {
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message) {
color: var(--ember-deep);
font-weight: 600;
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message)::before {
content: '■ ' / '';
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
transition: none;
}
}
/*
The input and the select share a row, lined up along their bottom edges,
since only the select has a small label above it.
*/
slab-date-time-field::part(fields) {
align-items: end;
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
slab-date-time-field::part(time-zone-field) {
display: grid;
gap: 0.25rem;
}
slab-date-time-field::part(time-zone-label) {
color: var(--ash);
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/*
The select's own chevron is the browser's, and sits wherever the browser
puts it. It's drawn here instead, as two strokes of the text color, so it
lines up with the input's calendar icon and follows dark mode and forced
colors.
*/
slab-date-time-field::part(time-zone) {
appearance: none;
background-color: var(--paper);
background-image:
linear-gradient(
to top right,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
),
linear-gradient(
to top left,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
);
background-position:
right 1.375rem center,
right 1rem center;
background-repeat: no-repeat;
background-size: 0.375rem 0.375rem;
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font: inherit;
inline-size: 100%;
min-inline-size: 0;
padding-block: 0;
padding-inline: 0.75rem 2.5rem;
transition:
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(time-zone):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(time-zone):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field:state(readonly)::part(time-zone) {
border-style: solid;
color: inherit;
cursor: default;
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(time-zone) {
transition: none;
}
}
tokens.css
:root {
/* Secondary text. 6.8:1 and 6.9:1 on paper. */
--ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
--border: 2px solid var(--ink);
/* Behind disabled and read-only controls, and hovered rows. */
--chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));
/*
The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
enough for borders, fills and large text, but not always for small text,
which takes "--ember-deep".
*/
--ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));
/*
Orange for small text on paper, and for paper text on it. 5.7:1 and
7.4:1.
*/
--ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
--font-body: var(
--slab-styled-font-body,
'IBM Plex Sans',
system-ui,
sans-serif
);
--font-display: var(
--slab-styled-font-display,
'Zilla Slab',
rockwell,
'Roboto Slab',
serif
);
--font-mono: var(
--slab-styled-font-mono,
'IBM Plex Mono',
ui-monospace,
monospace
);
--ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
--paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));
/* The hard, offset shadow a raised surface casts. */
--shadow: 4px 4px 0 var(--ink);
}
/*
Forced colors, such as Windows' contrast themes, replace every color that
isn't a system color, so ember fills and paper marks all become the same
background, and a checked Checkbox looks like an unchecked one. The palette
becomes the user's system colors instead, which are kept. Ember is the
highlight, the color of what's selected, and ember-deep, being for text and
for paper text on it, is the text color.
*/
@media (forced-colors: active) {
:host {
--ash: GrayText;
--chalk: Canvas;
--ember: Highlight;
--ember-deep: CanvasText;
--ink: CanvasText;
--paper: Canvas;
}
}
Under the hood, it's just the headless element, subclassed,
with styles set. That's it. To use it, copy
these files, swap the tag in @customElement()
for one of your own, and import it.
tokens.styles.ts holds the colors and fonts
every styled example shares, so you only need it once.
date-time-field.ts
import { customElement } from 'lit/decorators.js';
import DateTimeField from 'slab-elements/date-time-field.js';
import styles from './date-time-field.styles.js';
import textInput from './text-input.styles.js';
import tokens from './tokens.styles.js';
declare global {
interface HTMLElementTagNameMap {
'slab-styled-date-time-field': StyledDateTimeField;
}
}
/**
* Date Time Field, styled: Text Field's look, with the browser's own picker,
* and the time zone select beside the input with a small label of its own,
* wrapping below it when there's no room.
*/
@customElement('slab-styled-date-time-field')
export default class StyledDateTimeField extends DateTimeField {
static override styles = [tokens, textInput, styles];
}
date-time-field.styles.ts
import { css } from 'lit';
export default css`
/*
The input and the select share a row, lined up along their bottom edges,
since only the select has a small label above it.
*/
[part~='fields'] {
align-items: end;
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
[part~='time-zone-field'] {
display: grid;
gap: 0.25rem;
}
[part~='time-zone-label'] {
color: var(--ash);
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/*
The select's own chevron is the browser's, and sits wherever the browser
puts it. It's drawn here instead, as two strokes of the text color, so it
lines up with the input's calendar icon and follows dark mode and forced
colors.
*/
[part~='time-zone'] {
appearance: none;
background-color: var(--paper);
background-image:
linear-gradient(
to top right,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
),
linear-gradient(
to top left,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
);
background-position:
right 1.375rem center,
right 1rem center;
background-repeat: no-repeat;
background-size: 0.375rem 0.375rem;
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font: inherit;
inline-size: 100%;
min-inline-size: 0;
padding-block: 0;
padding-inline: 0.75rem 2.5rem;
transition:
border-color 100ms,
box-shadow 100ms,
translate 100ms;
&:focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
&:disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
}
:host(:state(readonly)) [part~='time-zone'] {
border-style: solid;
color: inherit;
cursor: default;
}
@media (prefers-reduced-motion: reduce) {
[part~='time-zone'] {
transition: none;
}
}
`;
text-input.styles.ts
import { css } from 'lit';
/*
The look shared by everything typed into: Text Field, Password Field,
Search Field, Textarea, Number, Date Field, Time Field, Combobox and Tags
Input, whose fields are "::part(input)", or "::part(textarea)" for Textarea.
File Drop starts from it too, for its label and description.
*/
export default css`
:host {
color: var(--ink);
display: grid;
font-family: var(--font-body);
}
[part~='label'] {
font-family: var(--font-display);
font-size: 1.0625rem;
font-weight: 600;
margin-block-end: 0.375rem;
}
:host(:state(required)) [part~='label']::after {
color: var(--ember-deep);
content: ' *' / '';
}
[part~='input'],
[part~='textarea'] {
background-color: var(--paper);
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
font: inherit;
/* A fixed height, shared with Select, so fields line up in a row. */
padding: 0 0.75rem;
transition:
background-color 100ms,
border-color 100ms,
box-shadow 100ms,
translate 100ms;
&::placeholder {
color: var(--ash);
}
/*
The outline is transparent rather than gone, so it still shows in forced
colors, where box shadows don't.
*/
&:focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
&:disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
}
[part~='textarea'] {
block-size: auto;
min-block-size: 7rem;
padding: 0.625rem 0.75rem;
resize: vertical;
}
:host(:state(readonly)) [part~='input'],
:host(:state(readonly)) [part~='textarea'] {
background-color: var(--chalk);
}
:host(:state(error)) [part~='input'],
:host(:state(error)) [part~='textarea'] {
border-color: var(--ember-deep);
}
/*
Spaced by what's in it rather than by a gap, so a description with
nothing in it takes no room, and a control beside the field lines up
with its bottom edge.
*/
[part~='description'] {
color: var(--ash);
display: grid;
font-size: 0.875rem;
}
::slotted([slot='description']) {
margin-block-start: 0.375rem;
}
[part~='validity-message'] {
color: var(--ember-deep);
font-weight: 600;
margin-block-start: 0.375rem;
&::before {
content: '■ ' / '';
}
}
@media (prefers-reduced-motion: reduce) {
[part~='input'],
[part~='textarea'] {
transition: none;
}
}
`;
tokens.styles.ts
import { css } from 'lit';
/*
The styled components' palette and type, taken from the logo: ink for the
courses, ember for the base, paper behind them.
Each is a short alias for a "--slab-styled-*" property, with the default as
its fallback. Retheming is "--slab-styled-ember" and the rest on ":root",
which every shadow root inherits. Were the defaults declared under those
names here instead, each host's own declaration would shadow the page's.
Each default is "light-dark()", so the components follow the page's
"color-scheme": "dark" for dark, "light" for light, and "light dark" to
follow the operating system. Ink and paper trade places in the dark, so
ink is always the text and paper always what's behind it. Contrast is given
as light, then dark.
*/
export default css`
:host {
/* Secondary text. 6.8:1 and 6.9:1 on paper. */
--ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
--border: 2px solid var(--ink);
/* Behind disabled and read-only controls, and hovered rows. */
--chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));
/*
The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
enough for borders, fills and large text, but not always for small text,
which takes "--ember-deep".
*/
--ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));
/*
Orange for small text on paper, and for paper text on it. 5.7:1 and
7.4:1.
*/
--ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
--font-body: var(
--slab-styled-font-body,
'IBM Plex Sans',
system-ui,
sans-serif
);
--font-display: var(
--slab-styled-font-display,
'Zilla Slab',
rockwell,
'Roboto Slab',
serif
);
--font-mono: var(
--slab-styled-font-mono,
'IBM Plex Mono',
ui-monospace,
monospace
);
--ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
--paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));
/* The hard, offset shadow a raised surface casts. */
--shadow: 4px 4px 0 var(--ink);
}
/*
Forced colors, such as Windows' contrast themes, replace every color that
isn't a system color, so ember fills and paper marks all become the same
background, and a checked Checkbox looks like an unchecked one. The palette
becomes the user's system colors instead, which are kept. Ember is the
highlight, the color of what's selected, and ember-deep, being for text and
for paper text on it, is the text color.
*/
@media (forced-colors: active) {
:host {
--ash: GrayText;
--chalk: Canvas;
--ember: Highlight;
--ember-deep: CanvasText;
--ink: CanvasText;
--paper: Canvas;
}
}
`;
The same styles, written from outside the element, so
there's nothing to subclass. The CSS styles every
<slab-date-time-field> on the page. Import
tokens.css, the colors and fonts every styled
example shares, once, wherever your global styles go.
Each component registers its headless element and imports its CSS. Use it like the element: its props are the element's attributes and properties.
DateTimeField.vue
<script setup>
import 'slab-elements/date-time-field.js';
import './date-time-field.css';
</script>
<template>
<slab-date-time-field><slot /></slab-date-time-field>
</template>
date-time-field.css
slab-date-time-field {
color: var(--ink);
display: grid;
font-family: var(--font-body);
}
slab-date-time-field::part(label) {
font-family: var(--font-display);
font-size: 1.0625rem;
font-weight: 600;
margin-block-end: 0.375rem;
}
slab-date-time-field:state(required)::part(label)::after {
color: var(--ember-deep);
content: ' *' / '';
}
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
background-color: var(--paper);
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
font: inherit;
/* A fixed height, shared with Select, so fields line up in a row. */
padding: 0 0.75rem;
transition:
background-color 100ms,
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(input)::placeholder,
slab-date-time-field::part(textarea)::placeholder {
color: var(--ash);
}
/*
The outline is transparent rather than gone, so it still shows in forced
colors, where box shadows don't.
*/
slab-date-time-field::part(input):focus-visible,
slab-date-time-field::part(textarea):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(input):disabled,
slab-date-time-field::part(textarea):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field::part(textarea) {
block-size: auto;
min-block-size: 7rem;
padding: 0.625rem 0.75rem;
resize: vertical;
}
slab-date-time-field:state(readonly)::part(input),
slab-date-time-field:state(readonly)::part(textarea) {
background-color: var(--chalk);
}
slab-date-time-field:state(error)::part(input),
slab-date-time-field:state(error)::part(textarea) {
border-color: var(--ember-deep);
}
/*
Spaced by what's in it rather than by a gap, so a description with
nothing in it takes no room, and a control beside the field lines up
with its bottom edge.
*/
slab-date-time-field::part(description) {
color: var(--ash);
display: grid;
font-size: 0.875rem;
}
slab-date-time-field > [slot='description'] {
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message) {
color: var(--ember-deep);
font-weight: 600;
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message)::before {
content: '■ ' / '';
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
transition: none;
}
}
/*
The input and the select share a row, lined up along their bottom edges,
since only the select has a small label above it.
*/
slab-date-time-field::part(fields) {
align-items: end;
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
slab-date-time-field::part(time-zone-field) {
display: grid;
gap: 0.25rem;
}
slab-date-time-field::part(time-zone-label) {
color: var(--ash);
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/*
The select's own chevron is the browser's, and sits wherever the browser
puts it. It's drawn here instead, as two strokes of the text color, so it
lines up with the input's calendar icon and follows dark mode and forced
colors.
*/
slab-date-time-field::part(time-zone) {
appearance: none;
background-color: var(--paper);
background-image:
linear-gradient(
to top right,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
),
linear-gradient(
to top left,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
);
background-position:
right 1.375rem center,
right 1rem center;
background-repeat: no-repeat;
background-size: 0.375rem 0.375rem;
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font: inherit;
inline-size: 100%;
min-inline-size: 0;
padding-block: 0;
padding-inline: 0.75rem 2.5rem;
transition:
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(time-zone):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(time-zone):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field:state(readonly)::part(time-zone) {
border-style: solid;
color: inherit;
cursor: default;
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(time-zone) {
transition: none;
}
}
tokens.css
:root {
/* Secondary text. 6.8:1 and 6.9:1 on paper. */
--ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
--border: 2px solid var(--ink);
/* Behind disabled and read-only controls, and hovered rows. */
--chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));
/*
The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
enough for borders, fills and large text, but not always for small text,
which takes "--ember-deep".
*/
--ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));
/*
Orange for small text on paper, and for paper text on it. 5.7:1 and
7.4:1.
*/
--ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
--font-body: var(
--slab-styled-font-body,
'IBM Plex Sans',
system-ui,
sans-serif
);
--font-display: var(
--slab-styled-font-display,
'Zilla Slab',
rockwell,
'Roboto Slab',
serif
);
--font-mono: var(
--slab-styled-font-mono,
'IBM Plex Mono',
ui-monospace,
monospace
);
--ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
--paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));
/* The hard, offset shadow a raised surface casts. */
--shadow: 4px 4px 0 var(--ink);
}
/*
Forced colors, such as Windows' contrast themes, replace every color that
isn't a system color, so ember fills and paper marks all become the same
background, and a checked Checkbox looks like an unchecked one. The palette
becomes the user's system colors instead, which are kept. Ember is the
highlight, the color of what's selected, and ember-deep, being for text and
for paper text on it, is the text color.
*/
@media (forced-colors: active) {
:host {
--ash: GrayText;
--chalk: Canvas;
--ember: Highlight;
--ember-deep: CanvasText;
--ink: CanvasText;
--paper: Canvas;
}
}
The same styles, written from outside the element, so
there's nothing to subclass. The CSS styles every
<slab-date-time-field> on the page. Import
tokens.css, the colors and fonts every styled
example shares, once, wherever your global styles go.
Import date-time-field.js once, such
as in your root layout, and use
<slab-date-time-field> as is. A Svelte component
around it would take slot="…" content as its
own slot and drop it.
date-time-field.js
import 'slab-elements/date-time-field.js';
import './date-time-field.css';
date-time-field.css
slab-date-time-field {
color: var(--ink);
display: grid;
font-family: var(--font-body);
}
slab-date-time-field::part(label) {
font-family: var(--font-display);
font-size: 1.0625rem;
font-weight: 600;
margin-block-end: 0.375rem;
}
slab-date-time-field:state(required)::part(label)::after {
color: var(--ember-deep);
content: ' *' / '';
}
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
background-color: var(--paper);
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
font: inherit;
/* A fixed height, shared with Select, so fields line up in a row. */
padding: 0 0.75rem;
transition:
background-color 100ms,
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(input)::placeholder,
slab-date-time-field::part(textarea)::placeholder {
color: var(--ash);
}
/*
The outline is transparent rather than gone, so it still shows in forced
colors, where box shadows don't.
*/
slab-date-time-field::part(input):focus-visible,
slab-date-time-field::part(textarea):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(input):disabled,
slab-date-time-field::part(textarea):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field::part(textarea) {
block-size: auto;
min-block-size: 7rem;
padding: 0.625rem 0.75rem;
resize: vertical;
}
slab-date-time-field:state(readonly)::part(input),
slab-date-time-field:state(readonly)::part(textarea) {
background-color: var(--chalk);
}
slab-date-time-field:state(error)::part(input),
slab-date-time-field:state(error)::part(textarea) {
border-color: var(--ember-deep);
}
/*
Spaced by what's in it rather than by a gap, so a description with
nothing in it takes no room, and a control beside the field lines up
with its bottom edge.
*/
slab-date-time-field::part(description) {
color: var(--ash);
display: grid;
font-size: 0.875rem;
}
slab-date-time-field > [slot='description'] {
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message) {
color: var(--ember-deep);
font-weight: 600;
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message)::before {
content: '■ ' / '';
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
transition: none;
}
}
/*
The input and the select share a row, lined up along their bottom edges,
since only the select has a small label above it.
*/
slab-date-time-field::part(fields) {
align-items: end;
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
slab-date-time-field::part(time-zone-field) {
display: grid;
gap: 0.25rem;
}
slab-date-time-field::part(time-zone-label) {
color: var(--ash);
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/*
The select's own chevron is the browser's, and sits wherever the browser
puts it. It's drawn here instead, as two strokes of the text color, so it
lines up with the input's calendar icon and follows dark mode and forced
colors.
*/
slab-date-time-field::part(time-zone) {
appearance: none;
background-color: var(--paper);
background-image:
linear-gradient(
to top right,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
),
linear-gradient(
to top left,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
);
background-position:
right 1.375rem center,
right 1rem center;
background-repeat: no-repeat;
background-size: 0.375rem 0.375rem;
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font: inherit;
inline-size: 100%;
min-inline-size: 0;
padding-block: 0;
padding-inline: 0.75rem 2.5rem;
transition:
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(time-zone):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(time-zone):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field:state(readonly)::part(time-zone) {
border-style: solid;
color: inherit;
cursor: default;
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(time-zone) {
transition: none;
}
}
tokens.css
:root {
/* Secondary text. 6.8:1 and 6.9:1 on paper. */
--ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
--border: 2px solid var(--ink);
/* Behind disabled and read-only controls, and hovered rows. */
--chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));
/*
The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
enough for borders, fills and large text, but not always for small text,
which takes "--ember-deep".
*/
--ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));
/*
Orange for small text on paper, and for paper text on it. 5.7:1 and
7.4:1.
*/
--ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
--font-body: var(
--slab-styled-font-body,
'IBM Plex Sans',
system-ui,
sans-serif
);
--font-display: var(
--slab-styled-font-display,
'Zilla Slab',
rockwell,
'Roboto Slab',
serif
);
--font-mono: var(
--slab-styled-font-mono,
'IBM Plex Mono',
ui-monospace,
monospace
);
--ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
--paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));
/* The hard, offset shadow a raised surface casts. */
--shadow: 4px 4px 0 var(--ink);
}
/*
Forced colors, such as Windows' contrast themes, replace every color that
isn't a system color, so ember fills and paper marks all become the same
background, and a checked Checkbox looks like an unchecked one. The palette
becomes the user's system colors instead, which are kept. Ember is the
highlight, the color of what's selected, and ember-deep, being for text and
for paper text on it, is the text color.
*/
@media (forced-colors: active) {
:host {
--ash: GrayText;
--chalk: Canvas;
--ember: Highlight;
--ember-deep: CanvasText;
--ink: CanvasText;
--paper: Canvas;
}
}
The same styles, written from outside the element, so
there's nothing to subclass. The CSS styles every
<slab-date-time-field> on the page. Import
tokens.css, the colors and fonts every styled
example shares, once, wherever your global styles go.
Each component registers its headless element and imports its CSS. Use it like the element: its attributes and its content go to the element.
DateTimeField.gjs
import 'slab-elements/date-time-field.js';
import './date-time-field.css';
export const DateTimeField = <template>
<slab-date-time-field ...attributes>{{yield}}</slab-date-time-field>
</template>;
date-time-field.css
slab-date-time-field {
color: var(--ink);
display: grid;
font-family: var(--font-body);
}
slab-date-time-field::part(label) {
font-family: var(--font-display);
font-size: 1.0625rem;
font-weight: 600;
margin-block-end: 0.375rem;
}
slab-date-time-field:state(required)::part(label)::after {
color: var(--ember-deep);
content: ' *' / '';
}
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
background-color: var(--paper);
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
font: inherit;
/* A fixed height, shared with Select, so fields line up in a row. */
padding: 0 0.75rem;
transition:
background-color 100ms,
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(input)::placeholder,
slab-date-time-field::part(textarea)::placeholder {
color: var(--ash);
}
/*
The outline is transparent rather than gone, so it still shows in forced
colors, where box shadows don't.
*/
slab-date-time-field::part(input):focus-visible,
slab-date-time-field::part(textarea):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(input):disabled,
slab-date-time-field::part(textarea):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field::part(textarea) {
block-size: auto;
min-block-size: 7rem;
padding: 0.625rem 0.75rem;
resize: vertical;
}
slab-date-time-field:state(readonly)::part(input),
slab-date-time-field:state(readonly)::part(textarea) {
background-color: var(--chalk);
}
slab-date-time-field:state(error)::part(input),
slab-date-time-field:state(error)::part(textarea) {
border-color: var(--ember-deep);
}
/*
Spaced by what's in it rather than by a gap, so a description with
nothing in it takes no room, and a control beside the field lines up
with its bottom edge.
*/
slab-date-time-field::part(description) {
color: var(--ash);
display: grid;
font-size: 0.875rem;
}
slab-date-time-field > [slot='description'] {
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message) {
color: var(--ember-deep);
font-weight: 600;
margin-block-start: 0.375rem;
}
slab-date-time-field::part(validity-message)::before {
content: '■ ' / '';
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(input),
slab-date-time-field::part(textarea) {
transition: none;
}
}
/*
The input and the select share a row, lined up along their bottom edges,
since only the select has a small label above it.
*/
slab-date-time-field::part(fields) {
align-items: end;
display: grid;
gap: 0.75rem;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
slab-date-time-field::part(time-zone-field) {
display: grid;
gap: 0.25rem;
}
slab-date-time-field::part(time-zone-label) {
color: var(--ash);
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
/*
The select's own chevron is the browser's, and sits wherever the browser
puts it. It's drawn here instead, as two strokes of the text color, so it
lines up with the input's calendar icon and follows dark mode and forced
colors.
*/
slab-date-time-field::part(time-zone) {
appearance: none;
background-color: var(--paper);
background-image:
linear-gradient(
to top right,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
),
linear-gradient(
to top left,
transparent calc(50% - 1px),
currentcolor calc(50% - 1px) calc(50% + 1px),
transparent calc(50% + 1px)
);
background-position:
right 1.375rem center,
right 1rem center;
background-repeat: no-repeat;
background-size: 0.375rem 0.375rem;
block-size: 3rem;
border: var(--border);
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font: inherit;
inline-size: 100%;
min-inline-size: 0;
padding-block: 0;
padding-inline: 0.75rem 2.5rem;
transition:
border-color 100ms,
box-shadow 100ms,
translate 100ms;
}
slab-date-time-field::part(time-zone):focus-visible {
box-shadow: 4px 4px 0 var(--ember);
outline: 2px solid transparent;
translate: -2px -2px;
}
slab-date-time-field::part(time-zone):disabled {
background-color: var(--chalk);
border-style: dashed;
color: var(--ash);
cursor: not-allowed;
}
slab-date-time-field:state(readonly)::part(time-zone) {
border-style: solid;
color: inherit;
cursor: default;
}
@media (prefers-reduced-motion: reduce) {
slab-date-time-field::part(time-zone) {
transition: none;
}
}
tokens.css
:root {
/* Secondary text. 6.8:1 and 6.9:1 on paper. */
--ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
--border: 2px solid var(--ink);
/* Behind disabled and read-only controls, and hovered rows. */
--chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));
/*
The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
enough for borders, fills and large text, but not always for small text,
which takes "--ember-deep".
*/
--ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));
/*
Orange for small text on paper, and for paper text on it. 5.7:1 and
7.4:1.
*/
--ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
--font-body: var(
--slab-styled-font-body,
'IBM Plex Sans',
system-ui,
sans-serif
);
--font-display: var(
--slab-styled-font-display,
'Zilla Slab',
rockwell,
'Roboto Slab',
serif
);
--font-mono: var(
--slab-styled-font-mono,
'IBM Plex Mono',
ui-monospace,
monospace
);
--ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
--paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));
/* The hard, offset shadow a raised surface casts. */
--shadow: 4px 4px 0 var(--ink);
}
/*
Forced colors, such as Windows' contrast themes, replace every color that
isn't a system color, so ember fills and paper marks all become the same
background, and a checked Checkbox looks like an unchecked one. The palette
becomes the user's system colors instead, which are kept. Ember is the
highlight, the color of what's selected, and ember-deep, being for text and
for paper text on it, is the text color.
*/
@media (forced-colors: active) {
:host {
--ash: GrayText;
--chalk: Canvas;
--ember: Highlight;
--ember-deep: CanvasText;
--ink: CanvasText;
--paper: Canvas;
}
}