Product
Loading the product.
The design kit’s buttons, busy buttons, marked and read-only fields, checkbox fields, steppers, callouts with Try again and dialogs, in each state they can be in. Its loading line, progress and toast are here too.
Each state is shown twice: live in your theme, marked Live, and as a preview in the other. The busy button, the failure with Try again and the part of the page that is loading are pictures in both themes, since a live copy would act as the page loads. The links among pages and the links in a row are pictures too, since the page has navigation of its own. Under each name is the code behind it. To see the other theme live, choose Light or Dark next to Theme, at the top of the page.
The busy button is a picture here. Behavior shows one working when you press it.
The code behind it: class="dk-button"
LightDark, preview only
<button type="button" class="dk-button">Filters</button><Button>Filters</Button>The code behind it: class="dk-button dk-button-accent"
LightDark, preview only
<button type="button" class="dk-button dk-button-accent">Save rule</button><Button accent>Save rule</Button>The code behind it: aria-pressed="true" with dk-button
LightDark, preview only
<button type="button" class="dk-button" aria-pressed="true">Members only</button><Button pressed>Members only</Button>The code behind it: aria-pressed="false" with dk-button
LightDark, preview only
<button type="button" class="dk-button" aria-pressed="false">Members only</button><Button pressed={false}>Members only</Button>The code behind it: aria-expanded="true" with dk-button dk-panel
Brand, size and color.
LightDark, preview only
Brand, size and color.
<button aria-expanded="true" aria-controls="filters-panel" type="button" class="dk-button">
Filters
</button>
<div id="filters-panel" class="dk-panel"><p>Brand, size and color.</p></div><>
<Button aria-expanded aria-controls="filters-panel">
Filters
</Button>
<div id="filters-panel" className="dk-panel">
<p>Brand, size and color.</p>
</div>
</>The code behind it: class="dk-close" with dk-button dk-panel dk-panel-title dk-button-text dk-button-quiet dk-visually-hidden
Ana deals first, and the cards go round to the left.
LightDark, preview only
Ana deals first, and the cards go round to the left.
<button aria-expanded="true" aria-controls="round-tips" type="button" class="dk-button">
Tips
</button>
<div id="round-tips" class="dk-panel">
<h4 class="dk-panel-title">Tips</h4>
<div class="dk-close">
<button type="button" class="dk-button dk-button-text dk-button-quiet">
<span aria-hidden="true">×</span>
<span class="dk-visually-hidden">Close tips</span>
</button>
</div>
<p>Ana deals first, and the cards go round to the left.</p>
</div><>
<Button aria-expanded aria-controls="round-tips">
Tips
</Button>
<div id="round-tips" className="dk-panel">
<h4 className="dk-panel-title">Tips</h4>
<div className="dk-close">
<Button text quiet>
<span aria-hidden="true">×</span>
<span className="dk-visually-hidden">Close tips</span>
</Button>
</div>
<p>Ana deals first, and the cards go round to the left.</p>
</div>
</>The code behind it: aria-disabled="true" with dk-button dk-field-hint
This is the first page.
LightDark, preview only
This is the first page.
<button aria-describedby="previous-why" type="button" class="dk-button" aria-disabled="true">
Previous
</button>
<p id="previous-why" class="dk-field-hint">This is the first page.</p><>
<Button off aria-describedby="previous-why">
Previous
</Button>
<p id="previous-why" className="dk-field-hint">
This is the first page.
</p>
</>The code behind it: data-busy="Saving the rule." with dk-button dk-button-accent
LightDark, a picture
LightDark, a picture
<button
type="button"
class="dk-button dk-button-accent"
aria-disabled="true"
data-busy="Saving the rule."
>
Save rule
</button><Button accent busy="Saving the rule.">
Save rule
</Button>The code behind it: class="dk-button dk-button-large"
LightDark, preview only
<button type="button" class="dk-button dk-button-large">Try it with your own products</button><Button large>Try it with your own products</Button>The code behind it: class="dk-button dk-button-tall"
LightDark, preview only
<button type="button" class="dk-button dk-button-tall">Save the round</button><Button tall>Save the round</Button>The code behind it: class="dk-button dk-button-icon" with dk-icon dk-visually-hidden
LightDark, preview only
<button type="button" class="dk-button dk-button-icon">
<svg class="dk-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
<path d="M12 19V5M6 11l6-6 6 6"></path>
</svg>
<span class="dk-visually-hidden">Move Ana up</span>
</button><Button icon>
<svg className="dk-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
<path d="M12 19V5M6 11l6-6 6 6" />
</svg>
<span className="dk-visually-hidden">Move Ana up</span>
</Button>The code behind it: class="dk-button dk-button-text"
LightDark, preview only
<button type="button" class="dk-button dk-button-text">Show the markup</button><Button text>Show the markup</Button>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/icon.spec.ts, in a browsere2e/controls.spec.tsx, in a browsere2e/ref.spec.ts, in a browsere2e/busy.spec.tsx, in a browserThe errors here are drawn by this page, so they stay as you fix them. The refused form on Behavior shows the kit clearing one.
The code behind it: class="dk-field-hint" with dk-field dk-field-label dk-input
Where the receipt goes
LightDark, preview only
Where the receipt goes
<div class="dk-field">
<label class="dk-field-label" for="email" id="email-label">Email</label>
<p class="dk-field-hint" id="email-hint">Where the receipt goes</p>
<input class="dk-input" id="email" aria-describedby="email-hint" />
</div><InputField id="email" label="Email" hint="Where the receipt goes" />The code behind it: aria-invalid="true" with dk-field dk-field-label dk-field-hint dk-field-error dk-visually-hidden dk-input
Where the receipt goes
Error: Enter an email address
LightDark, preview only
Where the receipt goes
Error: Enter an email address
<div class="dk-field">
<label class="dk-field-label" for="email-wrong" id="email-wrong-label">Email</label>
<p class="dk-field-hint" id="email-wrong-hint">Where the receipt goes</p>
<p class="dk-field-error" id="email-wrong-error">
<span class="dk-visually-hidden">Error: </span>
Enter an email address
</p>
<input
class="dk-input"
id="email-wrong"
aria-describedby="email-wrong-hint email-wrong-error"
aria-invalid="true"
/>
</div><InputField
id="email-wrong"
label="Email"
hint="Where the receipt goes"
error="Enter an email address"
/>The code behind it: disabled with dk-field dk-field-label dk-field-hint dk-input
Orders open again at nine tomorrow.
LightDark, preview only
Orders open again at nine tomorrow.
<div class="dk-field">
<label class="dk-field-label" for="store" id="store-label">Store</label>
<p class="dk-field-hint" id="store-hint">Orders open again at nine tomorrow.</p>
<input class="dk-input" disabled="" id="store" aria-describedby="store-hint" value="Closed" />
</div><InputField
id="store"
label="Store"
hint="Orders open again at nine tomorrow."
disabled
defaultValue="Closed"
/>The code behind it: class="dk-field-mark" with dk-field dk-field-label dk-input
LightDark, preview only
<div class="dk-field">
<label class="dk-field-label" for="rule-name" id="rule-name-label">
Rule name
<span class="dk-field-mark" aria-hidden="true">(required)</span>
</label>
<input class="dk-input" required="" id="rule-name" aria-required="true" />
</div>
<div class="dk-field">
<label class="dk-field-label" for="rule-note" id="rule-note-label">
Note
<span class="dk-field-mark">(optional)</span>
</label>
<input class="dk-input" id="rule-note" />
</div><>
<InputField id="rule-name" label="Rule name" mark="required" required />
<InputField id="rule-note" label="Note" mark="optional" />
</>The code behind it: readonly with dk-field dk-field-label dk-textarea dk-value dk-input dk-field-error dk-stepper-range dk-visually-hidden dk-stepper dk-button dk-stepper-down dk-stepper-value dk-stepper-up dk-stepper-limits dk-stepper-status
Error: Enter a whole number from 1 to 10.
LightDark, preview only
Error: Enter a whole number from 1 to 10.
<div class="dk-field">
<label class="dk-field-label" for="round" id="round-label">Round</label>
<textarea class="dk-textarea dk-value" rows="1" readonly="" id="round">Round 3 of 10</textarea>
</div>
<div class="dk-field">
<label class="dk-field-label" for="score" id="score-label">Score</label>
<input class="dk-input" readonly="" id="score" value="42" />
</div>
<div class="dk-field">
<label class="dk-field-label" for="game" id="game-label">Game</label>
<textarea class="dk-textarea dk-value" rows="1" readonly="" id="game">Wizard</textarea>
<input type="hidden" name="game" value="wizard" />
</div>
<div class="dk-field">
<label class="dk-field-label" for="cards" id="cards-label">Cards each</label>
<p class="dk-field-error dk-stepper-range" id="cards-range" hidden="">
<span class="dk-visually-hidden">Error: </span>
Enter a whole number from 1 to 10.
</p>
<div class="dk-stepper" role="group" aria-labelledby="cards-label">
<button type="button" class="dk-button dk-stepper-down" aria-controls="cards" hidden="">
<span aria-hidden="true">−</span>
<span class="dk-visually-hidden">Lower Cards each</span>
</button>
<input
class="dk-input dk-stepper-value"
type="number"
inputmode="numeric"
min="1"
max="10"
step="1"
readonly=""
id="cards"
value="3"
/>
<button type="button" class="dk-button dk-stepper-up" aria-controls="cards" hidden="">
<span aria-hidden="true">+</span>
<span class="dk-visually-hidden">Raise Cards each</span>
</button>
<span class="dk-visually-hidden dk-stepper-limits" id="cards-limits"></span>
<span class="dk-visually-hidden dk-stepper-status" role="status"></span>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachStepper } from '@jasonsdevspace/design-kit/controls';
import {
InputField,
SelectField,
StepperField,
ValueField,
} from '@jasonsdevspace/design-kit/react';
export const Values = () => {
const cards = useRef<HTMLInputElement>(null);
useEffect(() => (cards.current ? attachStepper(cards.current) : undefined), []);
return (
<>
<ValueField id="round" label="Round" defaultValue="Round 3 of 10" />
<InputField id="score" label="Score" defaultValue="42" readOnly />
<SelectField id="game" name="game" label="Game" defaultValue="wizard" readOnly>
<option value="flip-7">Flip 7</option>
<option value="wizard">Wizard</option>
</SelectField>
<StepperField
id="cards"
label="Cards each"
min={1}
max={10}
defaultValue={3}
readOnly
ref={cards}
/>
</>
);
};The code behind it: class="dk-field-action" with dk-field dk-field-label dk-input dk-button
LightDark, preview only
<div class="dk-field">
<label class="dk-field-label" for="search" id="search-label">Search the games</label>
<div class="dk-field-action">
<input class="dk-input" type="search" id="search" />
<button type="submit" class="dk-button">Search</button>
</div>
</div><InputField
id="search"
type="search"
label="Search the games"
action={<Button type="submit">Search</Button>}
/>The code behind it: class="dk-select" with dk-field dk-field-label
LightDark, preview only
<div class="dk-field">
<label class="dk-field-label" for="sort" id="sort-label">Sort by</label>
<select class="dk-select" id="sort">
<option value="">Choose an order</option>
<option value="price">Price</option>
</select>
</div><SelectField id="sort" label="Sort by">
<option value="">Choose an order</option>
<option value="price">Price</option>
</SelectField>The code behind it: class="dk-textarea" with dk-field dk-field-label dk-field-hint
Shown to the picker
LightDark, preview only
Shown to the picker
<div class="dk-field">
<label class="dk-field-label" for="note" id="note-label">Note</label>
<p class="dk-field-hint" id="note-hint">Shown to the picker</p>
<textarea class="dk-textarea" rows="3" id="note" aria-describedby="note-hint"></textarea>
</div><TextareaField id="note" label="Note" hint="Shown to the picker" />The code behind it: role="radiogroup" with dk-field dk-choice-field dk-field-label dk-field-hint dk-choices dk-choice dk-choice-words dk-choice-hint
LightDark, preview only
<fieldset class="dk-field dk-choice-field" id="rule" role="radiogroup" aria-describedby="rule-hint">
<legend class="dk-field-label">What the rule does</legend>
<p class="dk-field-hint" id="rule-hint">A rule applies to every search</p>
<div class="dk-choices">
<label class="dk-choice">
<input type="radio" name="rule" value="pin" />
<span class="dk-choice-words">
Pin
<span class="dk-choice-hint"> to the top of the results</span>
</span>
</label>
<label class="dk-choice">
<input type="radio" name="rule" checked="" value="hide" />
<span class="dk-choice-words">Hide</span>
</label>
</div>
</fieldset><ChoiceField
id="rule"
name="rule"
label="What the rule does"
hint="A rule applies to every search"
choices={[
{ value: 'pin', label: 'Pin', hint: 'to the top of the results' },
{ value: 'hide', label: 'Hide', defaultChecked: true },
]}
/>The code behind it: class="dk-field dk-choice-field" with dk-field-label dk-field-error dk-visually-hidden dk-choices dk-choice dk-choice-words
LightDark, preview only
<fieldset
class="dk-field dk-choice-field"
id="when"
role="radiogroup"
aria-describedby="when-error"
aria-invalid="true"
>
<legend class="dk-field-label">When</legend>
<p class="dk-field-error" id="when-error">
<span class="dk-visually-hidden">Error: </span>
Choose when the rule runs
</p>
<div class="dk-choices">
<label class="dk-choice">
<input type="radio" aria-describedby="when-error" name="when" value="always" />
<span class="dk-choice-words">Always</span>
</label>
<label class="dk-choice">
<input type="radio" aria-describedby="when-error" name="when" value="sale" />
<span class="dk-choice-words">During a sale</span>
</label>
</div>
</fieldset><ChoiceField
id="when"
name="when"
label="When"
error="Choose when the rule runs"
choices={[
{ value: 'always', label: 'Always' },
{ value: 'sale', label: 'During a sale' },
]}
/>The code behind it: class="dk-choices dk-choices-row" with dk-field dk-choice-field dk-field-label dk-choice dk-choice-words
LightDark, preview only
<fieldset class="dk-field dk-choice-field" id="facets">
<legend class="dk-field-label">Show</legend>
<div class="dk-choices dk-choices-row">
<label class="dk-choice">
<input type="checkbox" name="facets" checked="" value="brand" />
<span class="dk-choice-words">Brand</span>
</label>
<label class="dk-choice">
<input type="checkbox" name="facets" value="price" />
<span class="dk-choice-words">Price</span>
</label>
<label class="dk-choice">
<input type="checkbox" name="facets" value="color" />
<span class="dk-choice-words">Color</span>
</label>
</div>
</fieldset><ChoiceField
id="facets"
name="facets"
type="checkbox"
label="Show"
row
choices={[
{ value: 'brand', label: 'Brand', defaultChecked: true },
{ value: 'price', label: 'Price' },
{ value: 'color', label: 'Color' },
]}
/>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/controls.spec.tsx, in a browsere2e/ref.spec.ts, in a browsere2e/layouts.spec.ts, in a browsere2e/marks.spec.tsx, in a browsere2e/readonly.spec.tsx, in a browserThe error here is drawn by this page, so it stays as you check the box. The refused form on Behavior shows the kit clearing one.
The code behind it: class="dk-choice" with dk-field dk-choice-words
LightDark, preview only
<div class="dk-field">
<label class="dk-choice" for="sale" id="sale-label">
<input type="checkbox" id="sale" name="sale" />
<span class="dk-choice-words">Show sale prices</span>
</label>
</div><CheckboxField id="sale" name="sale" label="Show sale prices" />The code behind it: class="dk-field-hint" with dk-field dk-choice dk-choice-words
They show again once restocked
LightDark, preview only
They show again once restocked
<div class="dk-field">
<label class="dk-choice" for="sold-out" id="sold-out-label">
<input
type="checkbox"
id="sold-out"
aria-describedby="sold-out-hint"
name="sold-out"
checked=""
/>
<span class="dk-choice-words">Hide sold-out items</span>
</label>
<p class="dk-field-hint" id="sold-out-hint">They show again once restocked</p>
</div><CheckboxField
id="sold-out"
name="sold-out"
label="Hide sold-out items"
hint="They show again once restocked"
defaultChecked
/>The code behind it: aria-invalid="true" with dk-field-intro dk-field dk-field-error dk-visually-hidden dk-choice dk-choice-words dk-field-mark
Read the kit's license, the terms it is offered under.
Error: Select if you agree to the terms above.
LightDark, preview only
Read the kit's license, the terms it is offered under.
Error: Select if you agree to the terms above.
<p class="dk-field-intro">
<a href="https://github.com/jasonsdevspace/design-kit/blob/main/LICENSE">Read the kit's license</a>,
the terms it is offered under.
</p>
<div class="dk-field">
<p class="dk-field-error" id="terms-error">
<span class="dk-visually-hidden">Error: </span>
Select if you agree to the terms above.
</p>
<label class="dk-choice" for="terms" id="terms-label">
<input
required=""
type="checkbox"
id="terms"
aria-describedby="terms-error"
aria-invalid="true"
aria-required="true"
name="terms"
/>
<span class="dk-choice-words">
I agree to the terms
<span class="dk-field-mark" aria-hidden="true">(required)</span>
</span>
</label>
</div><>
<p className="dk-field-intro">
<a href="https://github.com/jasonsdevspace/design-kit/blob/main/LICENSE">
Read the kit's license
</a>
, the terms it is offered under.
</p>
<CheckboxField
id="terms"
name="terms"
label="I agree to the terms"
mark="required"
error="Select if you agree to the terms above."
required
/>
</>The code behind it: readonly with dk-field dk-field-label dk-textarea dk-value
LightDark, preview only
<div class="dk-field">
<label class="dk-field-label" for="sounds" id="sounds-label">Sounds</label>
<textarea class="dk-textarea dk-value" rows="1" readonly="" id="sounds">On</textarea>
<input type="hidden" name="sounds" value="on" />
</div>
<div class="dk-field">
<label class="dk-field-label" for="vibration" id="vibration-label">Vibration</label>
<textarea class="dk-textarea dk-value" rows="1" readonly="" id="vibration">Off</textarea>
</div><>
<CheckboxField id="sounds" name="sounds" label="Sounds" readOnly defaultChecked />
<CheckboxField id="vibration" name="vibration" label="Vibration" readOnly />
</>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/checkbox.spec.tsx, in a browsere2e/controls.spec.tsx, in a browserThe code behind it: class="dk-stepper" with dk-field dk-field-label dk-field-error dk-stepper-range dk-visually-hidden dk-button dk-stepper-down dk-input dk-stepper-value dk-stepper-up dk-stepper-limits dk-stepper-status
Error: Enter a whole number from 1 to 8.
LightDark, preview only
Error: Enter a whole number from 1 to 8.
<div class="dk-field">
<label class="dk-field-label" for="guests" id="guests-label">Guests</label>
<p class="dk-field-error dk-stepper-range" id="guests-range" hidden="">
<span class="dk-visually-hidden">Error: </span>
Enter a whole number from 1 to 8.
</p>
<div class="dk-stepper" role="group" aria-labelledby="guests-label">
<button type="button" class="dk-button dk-stepper-down" aria-controls="guests" hidden="">
<span aria-hidden="true">−</span>
<span class="dk-visually-hidden">Lower Guests</span>
</button>
<input
class="dk-input dk-stepper-value"
type="number"
inputmode="numeric"
min="1"
max="8"
step="1"
id="guests"
value="2"
/>
<button type="button" class="dk-button dk-stepper-up" aria-controls="guests" hidden="">
<span aria-hidden="true">+</span>
<span class="dk-visually-hidden">Raise Guests</span>
</button>
<span class="dk-visually-hidden dk-stepper-limits" id="guests-limits"></span>
<span class="dk-visually-hidden dk-stepper-status" role="status"></span>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachStepper } from '@jasonsdevspace/design-kit/controls';
import { StepperField } from '@jasonsdevspace/design-kit/react';
export const Guests = () => {
const guests = useRef<HTMLInputElement>(null);
useEffect(() => (guests.current ? attachStepper(guests.current) : undefined), []);
return (
<StepperField id="guests" label="Guests" min={1} max={8} defaultValue={2} ref={guests} />
);
};The code behind it: class="dk-field dk-stepper-inline" with dk-field-label dk-field-error dk-stepper-range dk-visually-hidden dk-stepper dk-button dk-stepper-down dk-input dk-stepper-value dk-stepper-up dk-stepper-limits dk-stepper-status
Error: Enter a whole number from 2 to 8.
LightDark, preview only
Error: Enter a whole number from 2 to 8.
<div class="dk-field dk-stepper-inline">
<label class="dk-field-label" for="players" id="players-label">Players</label>
<p class="dk-field-error dk-stepper-range" id="players-range" hidden="">
<span class="dk-visually-hidden">Error: </span>
Enter a whole number from 2 to 8.
</p>
<div class="dk-stepper" role="group" aria-labelledby="players-label">
<button type="button" class="dk-button dk-stepper-down" aria-controls="players" hidden="">
<span aria-hidden="true">−</span>
<span class="dk-visually-hidden">Lower the number of players</span>
</button>
<input
class="dk-input dk-stepper-value"
type="number"
inputmode="numeric"
min="2"
max="8"
step="1"
id="players"
value="4"
/>
<button type="button" class="dk-button dk-stepper-up" aria-controls="players" hidden="">
<span aria-hidden="true">+</span>
<span class="dk-visually-hidden">Raise the number of players</span>
</button>
<span class="dk-visually-hidden dk-stepper-limits" id="players-limits"></span>
<span class="dk-visually-hidden dk-stepper-status" role="status"></span>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachStepper } from '@jasonsdevspace/design-kit/controls';
import { StepperField } from '@jasonsdevspace/design-kit/react';
export const Players = () => {
const players = useRef<HTMLInputElement>(null);
useEffect(() => (players.current ? attachStepper(players.current) : undefined), []);
return (
<StepperField
id="players"
label="Players"
subject="the number of players"
min={2}
max={8}
defaultValue={4}
inline
ref={players}
/>
);
};The code behind it: class="dk-stepper dk-stepper-tall" with dk-field dk-field-label dk-field-error dk-stepper-range dk-visually-hidden dk-button dk-stepper-down dk-input dk-stepper-value dk-stepper-up dk-stepper-limits dk-stepper-status
Error: Enter a whole number from 0 to 10.
LightDark, preview only
Error: Enter a whole number from 0 to 10.
<div class="dk-field">
<label class="dk-field-label" for="bid" id="bid-label">Bid</label>
<p class="dk-field-error dk-stepper-range" id="bid-range" hidden="">
<span class="dk-visually-hidden">Error: </span>
Enter a whole number from 0 to 10.
</p>
<div class="dk-stepper dk-stepper-tall" role="group" aria-labelledby="bid-label">
<button type="button" class="dk-button dk-stepper-down" aria-controls="bid" hidden="">
<span aria-hidden="true">−</span>
<span class="dk-visually-hidden">Lower Bid</span>
</button>
<input
class="dk-input dk-stepper-value"
type="number"
inputmode="numeric"
min="0"
max="10"
step="1"
id="bid"
value="3"
/>
<button type="button" class="dk-button dk-stepper-up" aria-controls="bid" hidden="">
<span aria-hidden="true">+</span>
<span class="dk-visually-hidden">Raise Bid</span>
</button>
<span class="dk-visually-hidden dk-stepper-limits" id="bid-limits"></span>
<span class="dk-visually-hidden dk-stepper-status" role="status"></span>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachStepper } from '@jasonsdevspace/design-kit/controls';
import { StepperField } from '@jasonsdevspace/design-kit/react';
export const Bid = () => {
const bid = useRef<HTMLInputElement>(null);
useEffect(() => (bid.current ? attachStepper(bid.current) : undefined), []);
return <StepperField id="bid" label="Bid" min={0} max={10} defaultValue={3} tall ref={bid} />;
};The code behind it: class="dk-field-error dk-stepper-range" with dk-field dk-field-label dk-visually-hidden dk-stepper dk-button dk-stepper-down dk-input dk-stepper-value dk-stepper-up dk-stepper-limits dk-stepper-status
Error: Enter a number from 0 to 10
LightDark, preview only
Error: Enter a number from 0 to 10
<div class="dk-field">
<label class="dk-field-label" for="tricks" id="tricks-label">Tricks taken</label>
<p class="dk-field-error dk-stepper-range" id="tricks-range" hidden="">
<span class="dk-visually-hidden">Error: </span>
Enter a number from 0 to 10
</p>
<div class="dk-stepper" role="group" aria-labelledby="tricks-label">
<button type="button" class="dk-button dk-stepper-down" aria-controls="tricks" hidden="">
<span aria-hidden="true">−</span>
<span class="dk-visually-hidden">Lower Tricks taken</span>
</button>
<input
class="dk-input dk-stepper-value"
type="number"
inputmode="numeric"
min="0"
max="10"
step="1"
id="tricks"
value="11"
/>
<button type="button" class="dk-button dk-stepper-up" aria-controls="tricks" hidden="">
<span aria-hidden="true">+</span>
<span class="dk-visually-hidden">Raise Tricks taken</span>
</button>
<span class="dk-visually-hidden dk-stepper-limits" id="tricks-limits"></span>
<span class="dk-visually-hidden dk-stepper-status" role="status"></span>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachStepper } from '@jasonsdevspace/design-kit/controls';
import { StepperField } from '@jasonsdevspace/design-kit/react';
export const Tricks = () => {
const tricks = useRef<HTMLInputElement>(null);
useEffect(() => (tricks.current ? attachStepper(tricks.current) : undefined), []);
return (
<StepperField
id="tricks"
label="Tricks taken"
min={0}
max={10}
defaultValue={11}
rangeError="Enter a number from 0 to 10"
ref={tricks}
/>
);
};These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/stepper.spec.tsx, in a browsere2e/stepper-height.spec.tsx, in a browserThe code behind it: class="dk-dialog" with dk-button dk-dialog-title dk-dialog-actions dk-button-accent
LightDark, preview only
<button type="button" class="dk-button" aria-haspopup="dialog" aria-controls="end-game">
End the game
</button>
<dialog
class="dk-dialog"
id="end-game"
aria-labelledby="end-game-title"
aria-describedby="end-game-text"
>
<h2 class="dk-dialog-title" id="end-game-title">End the game now?</h2>
<p id="end-game-text">The scores so far are kept in the history.</p>
<form class="dk-dialog-actions" method="dialog">
<button type="submit" class="dk-button" value="keep">Keep playing</button>
<button type="submit" class="dk-button dk-button-accent" value="end">End the game</button>
</form>
</dialog><>
<button type="button" className="dk-button" aria-haspopup="dialog" aria-controls="end-game">
End the game
</button>
<dialog
className="dk-dialog"
id="end-game"
aria-labelledby="end-game-title"
aria-describedby="end-game-text"
>
<h2 className="dk-dialog-title" id="end-game-title">
End the game now?
</h2>
<p id="end-game-text">The scores so far are kept in the history.</p>
<form method="dialog" className="dk-dialog-actions">
<button type="submit" className="dk-button" value="keep">
Keep playing
</button>
<button type="submit" className="dk-button dk-button-accent" value="end">
End the game
</button>
</form>
</dialog>
</>The code behind it: class="dk-dialog dk-dialog-sheet" with dk-button dk-dialog-title dk-field dk-field-label dk-select dk-dialog-actions dk-button-accent
LightDark, preview only
<button type="button" class="dk-button" aria-haspopup="dialog" aria-controls="round-options">
Round options
</button>
<dialog class="dk-dialog dk-dialog-sheet" id="round-options" aria-labelledby="round-options-title">
<h2 class="dk-dialog-title" id="round-options-title" tabindex="-1" autofocus="">
Round options
</h2>
<div class="dk-field">
<label class="dk-field-label" for="dealt" id="dealt-label">Cards dealt</label>
<select class="dk-select" id="dealt">
<option value="10">Ten each</option>
<option value="7">Seven each</option>
</select>
</div>
<form class="dk-dialog-actions" method="dialog">
<button type="submit" class="dk-button dk-button-accent">Done</button>
</form>
</dialog><>
<button
type="button"
className="dk-button"
aria-haspopup="dialog"
aria-controls="round-options"
>
Round options
</button>
<dialog
className="dk-dialog dk-dialog-sheet"
id="round-options"
aria-labelledby="round-options-title"
>
<h2 className="dk-dialog-title" id="round-options-title" tabIndex={-1} autoFocus>
Round options
</h2>
<SelectField id="dealt" label="Cards dealt">
<option value="10">Ten each</option>
<option value="7">Seven each</option>
</SelectField>
<form method="dialog" className="dk-dialog-actions">
<button type="submit" className="dk-button dk-button-accent">
Done
</button>
</form>
</dialog>
</>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/dialog.spec.ts, in a browserThe failure with Try again is a picture here. Behavior shows one working when you press it.
The code behind it: class="dk-callout" with dk-callout-body dk-callout-title
The catalog was updated
New products are in the results.
LightDark, preview only
The catalog was updated
New products are in the results.
<div class="dk-callout">
<div class="dk-callout-body">
<p class="dk-callout-title">The catalog was updated</p>
<p>New products are in the results.</p>
</div>
</div><Callout title="The catalog was updated">
<p>New products are in the results.</p>
</Callout>The code behind it: class="dk-callout dk-callout-success" with dk-callout-body dk-callout-title dk-visually-hidden
Success: The rule was saved
It applies to the next search.
LightDark, preview only
Success: The rule was saved
It applies to the next search.
<div class="dk-callout dk-callout-success">
<div class="dk-callout-body">
<p class="dk-callout-title">
<span class="dk-visually-hidden">Success: </span>
The rule was saved
</p>
<p>It applies to the next search.</p>
</div>
</div><Callout tone="success" title="The rule was saved">
<p>It applies to the next search.</p>
</Callout>The code behind it: class="dk-callout dk-callout-danger" with dk-callout-body dk-callout-title dk-visually-hidden dk-callout-actions dk-button
Error: The products could not be loaded
Check the file, then load it again.
LightDark, preview only
Error: The products could not be loaded
Check the file, then load it again.
<div class="dk-callout dk-callout-danger">
<div class="dk-callout-body">
<p class="dk-callout-title">
<span class="dk-visually-hidden">Error: </span>
The products could not be loaded
</p>
<p>Check the file, then load it again.</p>
</div>
<div class="dk-callout-actions"><button type="button" class="dk-button">Try again</button></div>
</div><Callout
tone="danger"
title="The products could not be loaded"
actions={<Button>Try again</Button>}
>
<p>Check the file, then load it again.</p>
</Callout>The code behind it: role="alert" with dk-callout dk-callout-danger dk-callout-body dk-callout-title dk-visually-hidden dk-callout-actions dk-button
LightDark, a picture
Error: The products could not be loaded
Check your connection.
LightDark, a picture
Error: The products could not be loaded
Check your connection.
<div class="dk-callout dk-callout-danger">
<div class="dk-callout-body" role="alert">
<p class="dk-callout-title">
<span class="dk-visually-hidden">Error: </span>
The products could not be loaded
</p>
<p>Check your connection.</p>
</div>
<div class="dk-callout-actions"><button type="button" class="dk-button">Try again</button></div>
</div><Callout
tone="danger"
live="alert"
title="The products could not be loaded"
actions={<Button>Try again</Button>}
>
<p>Check your connection.</p>
</Callout>The code behind it: class="dk-callout dk-callout-warning" with dk-callout-body dk-callout-title dk-visually-hidden
Warning: Three products are running low
Each has fewer than five left.
LightDark, preview only
Warning: Three products are running low
Each has fewer than five left.
<div class="dk-callout dk-callout-warning">
<div class="dk-callout-body">
<p class="dk-callout-title">
<span class="dk-visually-hidden">Warning: </span>
Three products are running low
</p>
<p>Each has fewer than five left.</p>
</div>
</div><Callout tone="warning" title="Three products are running low">
<p>Each has fewer than five left.</p>
</Callout>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/controls.spec.tsx, in a browsere2e/try-again.spec.tsx, in a browserA toast says what just happened, at the foot of the screen, and can offer one action, such as Undo. The button here shows one. A toast with Undo stays until it is dismissed, and the one Undo shows leaves after five seconds. The toast in an app’s frame is under App pieces, in both themes.
The code behind it: class="dk-toast" with dk-toast-message dk-visually-hidden dk-toast-status dk-toast-buttons dk-button dk-button-text dk-toast-action dk-button-quiet dk-toast-close
<div class="dk-toast">
<p class="dk-toast-message" aria-hidden="true"></p>
<p class="dk-visually-hidden dk-toast-status" role="status"></p>
<div class="dk-toast-buttons">
<button
type="button"
tabindex="0"
class="dk-button dk-button-text dk-toast-action"
hidden=""
></button>
<button
type="button"
tabindex="0"
class="dk-button dk-button-text dk-button-quiet dk-toast-close"
hidden=""
>
<span aria-hidden="true">×</span>
<span class="dk-visually-hidden">Close</span>
</button>
</div>
</div>import { useEffect, useRef } from 'react';
import { attachToast } from '@jasonsdevspace/design-kit/controls';
import { Toast } from '@jasonsdevspace/design-kit/react';
export const Saved = () => {
const toast = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!toast.current) return undefined;
const attached = new AbortController();
const show = attachToast(toast.current, { signal: attached.signal });
show('Round 3 saved.', {
label: 'Undo',
onAction: () => show('Round 3 is back as it was.'),
});
return () => {
attached.abort();
};
}, []);
return <Toast ref={toast} />;
};These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/toast.spec.tsx, in a browserThe part of the page that is loading is a picture here. Behavior shows one working when you press it.
The code behind it: class="dk-loading"
LightDark, a picture
Loading the product.
LightDark, a picture
Loading the product.
<article aria-labelledby="product" aria-busy="true">
<h4 id="product">Product</h4>
<p class="dk-loading">Loading the product.</p>
</article>The code behind it: class="dk-progress" with dk-field dk-field-label dk-field-hint
12 of 40
LightDark, preview only
12 of 40
<div class="dk-field">
<label class="dk-field-label" for="import">Importing products</label>
<progress
id="import"
class="dk-progress"
value="12"
max="40"
aria-describedby="import-words"
></progress>
<p class="dk-field-hint" id="import-words">12 of 40</p>
</div><Progress id="import" label="Importing products" value={12} max={40} words="12 of 40" />These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/loading.spec.tsx, in a browsere2e/progress.spec.tsx, in a browserThe code behind it: class="dk-theme-switch" with dk-theme-switch-name dk-theme-switch-button dk-theme-switch-choices dk-theme-switch-choice dk-visually-hidden dk-theme-switch-noscript
LightDark, preview only
<div class="dk-theme-switch" hidden="">
<span class="dk-theme-switch-name" id="theme-name">Theme</span>
<button
type="button"
class="dk-theme-switch-button"
id="theme-button"
aria-labelledby="theme-name theme-button"
aria-expanded="false"
aria-controls="theme-choices"
>
System
</button>
<div
class="dk-theme-switch-choices"
id="theme-choices"
role="radiogroup"
aria-labelledby="theme-name"
aria-describedby="theme-note"
>
<label class="dk-theme-switch-choice">
<input type="radio" name="theme" value="system" />
<span>System</span>
</label>
<label class="dk-theme-switch-choice">
<input type="radio" name="theme" value="light" />
<span>Light</span>
</label>
<label class="dk-theme-switch-choice">
<input type="radio" name="theme" value="dark" />
<span>Dark</span>
</label>
</div>
<span class="dk-visually-hidden" id="theme-note">
Your choice is saved for every page on jasonsdevspace.com.
</span>
</div>
<noscript>
<p class="dk-theme-switch-noscript">With scripts on, a Theme switch sits here.</p>
</noscript>import { useEffect, useRef } from 'react';
import { attachThemeSwitch } from '@jasonsdevspace/design-kit/controls';
import { ThemeSwitch } from '@jasonsdevspace/design-kit/react';
export const Settings = () => {
const theme = useRef<HTMLDivElement>(null);
useEffect(() => (theme.current ? attachThemeSwitch(theme.current) : undefined), []);
return (
<ThemeSwitch
id="theme"
name="theme"
note="Your choice is saved for every page on jasonsdevspace.com."
ref={theme}
/>
);
};These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/pieces.spec.ts, in a browsere2e/attach.spec.tsx, in a browserThe code behind it: class="dk-button dk-copy" with dk-code dk-copy-words dk-visually-hidden
npm install @jasonsdevspace/design-kitLightDark, preview only
npm install @jasonsdevspace/design-kit<pre
class="dk-code"
id="install"
role="region"
aria-label="The install command"
tabindex="0"
><code>npm install @jasonsdevspace/design-kit</code></pre>
<button type="button" class="dk-button dk-copy" hidden="">
<span class="dk-copy-words">
<span>Copy</span>
<span aria-hidden="true">Copied</span>
<span aria-hidden="true">Selected</span>
</span>
<span class="dk-visually-hidden"> install command</span>
</button>
<p class="dk-visually-hidden" role="status"></p>import { useEffect, useRef } from 'react';
import { attachCopyButton } from '@jasonsdevspace/design-kit/controls';
import { CopyButton, StatusLine } from '@jasonsdevspace/design-kit/react';
export const Install = () => {
const block = useRef<HTMLPreElement>(null);
const button = useRef<HTMLButtonElement>(null);
const status = useRef<HTMLParagraphElement>(null);
useEffect(() => {
const source = block.current;
if (!source || !button.current || !status.current) return undefined;
return attachCopyButton(button.current, { source: () => source, status: status.current });
}, []);
return (
<>
<pre
className="dk-code"
id="install"
role="region"
aria-label="The install command"
tabIndex={0}
ref={block}
>
<code>npm install @jasonsdevspace/design-kit</code>
</pre>
<CopyButton name="install command" ref={button} />
<StatusLine ref={status} />
</>
);
};These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
src/react.test.tsx, without a browsere2e/pieces.spec.ts, in a browsere2e/attach.spec.tsx, in a browserThe links among pages are a picture here. The site’s own navigation, at the top of this page, is the live one.
The code behind it: class="dk-pill" with dk-pills
LightDark, preview only
<ul class="dk-pills" role="list">
<li class="dk-pill">TypeScript</li>
<li class="dk-pill">React</li>
</ul><ul className="dk-pills" role="list">
<li className="dk-pill">TypeScript</li>
<li className="dk-pill">React</li>
</ul>The code behind it: aria-current="page" with dk-pills dk-pill
LightDark, a picture
LightDark, a picture
<nav aria-label="Pages" id="pages">
<ul class="dk-pills" role="list">
<li><a class="dk-pill" href="#pages" aria-current="page">Home</a></li>
<li><a class="dk-pill" href="#pages">Tokens</a></li>
</ul>
</nav><nav aria-label="Pages" id="pages">
<ul className="dk-pills" role="list">
<li>
<a className="dk-pill" href="#pages" aria-current="page">
Home
</a>
</li>
<li>
<a className="dk-pill" href="#pages">
Tokens
</a>
</li>
</ul>
</nav>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/pieces.spec.ts, in a browserThe links in a row are a picture here. The pieces together has a live row of them at its top.
The code behind it: class="dk-tab" with dk-tabs
LightDark, a picture
LightDark, a picture
<nav aria-label="Categories" id="categories">
<ul class="dk-tabs" role="list">
<li><a class="dk-tab" href="#categories" aria-current="page">All</a></li>
<li><a class="dk-tab" href="#categories">Books</a></li>
</ul>
</nav><nav aria-label="Categories" id="categories">
<ul className="dk-tabs" role="list">
<li>
<a className="dk-tab" href="#categories" aria-current="page">
All
</a>
</li>
<li>
<a className="dk-tab" href="#categories">
Books
</a>
</li>
</ul>
</nav>The code behind it: aria-pressed="true" with dk-tabs dk-tab
LightDark, preview only
<div class="dk-tabs">
<button type="button" class="dk-tab" aria-pressed="true">Open</button>
<button type="button" class="dk-tab" aria-pressed="false">Closed</button>
</div><div className="dk-tabs">
<button type="button" className="dk-tab" aria-pressed="true">
Open
</button>
<button type="button" className="dk-tab" aria-pressed="false">
Closed
</button>
</div>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/pieces.spec.ts, in a browserThe code behind it: class="dk-eyebrow"
Signed in as a guest
LightDark, preview only
Signed in as a guest
<p class="dk-eyebrow">Signed in as a guest</p>
<h4>Your basket</h4><>
<p className="dk-eyebrow">Signed in as a guest</p>
<h4>Your basket</h4>
</>These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.
e2e/pieces.spec.ts, in a browser