Feedback and overlays
Bottom sheet
A dialog that comes up from the bottom edge, for choices and short forms on a phone. .kui-dialog--sheet is a sheet at every width. .kui-dialog--sheet-phone is a centred dialog on a wide screen and a sheet below 640 pixels.
Examples
A sheet of actions
The sheet takes the full width, at most 85 percent of the screen height, and leaves room for the home bar of the phone. The handle at the top shows that it is a sheet.
HTML
<button class="kui-button" type="button" data-kui-open="sheet-share"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#share-2"></use></svg><span>Share</span></button>
<kui-dialog id="sheet-share">
<dialog class="kui-dialog kui-dialog--sheet" aria-labelledby="sheet-share-title">
<div class="kui-dialog__head">
<h2 class="kui-dialog__title" id="sheet-share-title">Share “Ponuda za Šabac”</h2>
<button class="kui-button kui-button--icon kui-button--ghost kui-dialog__close" data-kui-close><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#close"></use></svg></button>
</div>
<div class="kui-dialog__body">
<div class="kui-stack kui-gap-2">
<button class="kui-button kui-button--block kui-button--ghost" data-kui-close="link"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#link"></use></svg><span>Copy link</span></button>
<button class="kui-button kui-button--block kui-button--ghost" data-kui-close="mail"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#mail"></use></svg><span>Send by email</span></button>
<button class="kui-button kui-button--block kui-button--ghost" data-kui-close="pdf"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#download"></use></svg><span>Download as PDF</span></button>
</div>
</div>
<div class="kui-dialog__foot"><button class="kui-button" data-kui-close="cancel">Cancel</button></div>
</dialog>
</kui-dialog>
A dialog that becomes a sheet on a phone
The same markup serves both sizes. Narrow the window below 640 pixels and open it again to see the sheet.
HTML
<button class="kui-button" type="button" data-kui-open="sheet-filter"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#sliders-horizontal"></use></svg><span>Filters</span></button>
<kui-dialog id="sheet-filter">
<dialog class="kui-dialog kui-dialog--sm kui-dialog--sheet-phone" aria-labelledby="sheet-filter-title">
<div class="kui-dialog__head">
<h2 class="kui-dialog__title" id="sheet-filter-title">Filter invoices</h2>
<button class="kui-button kui-button--icon kui-button--ghost kui-dialog__close" data-kui-close><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#close"></use></svg></button>
</div>
<div class="kui-dialog__body">
<div class="kui-form">
<div class="kui-field">
<label class="kui-label" for="sheet-filter-status">Status</label>
<div class="kui-select"><select id="sheet-filter-status"><option>Any status</option><option>Unpaid</option><option>Overdue</option><option>Paid</option></select></div>
</div>
<fieldset class="kui-fieldset">
<legend>Currency</legend>
<div class="kui-choices kui-choices--row">
<label class="kui-check"><input class="kui-checkbox" type="checkbox" name="currency" value="rsd" checked><span>RSD</span></label>
<label class="kui-check"><input class="kui-checkbox" type="checkbox" name="currency" value="eur" checked><span>EUR</span></label>
<label class="kui-check"><input class="kui-checkbox" type="checkbox" name="currency" value="chf"><span>CHF</span></label>
</div>
</fieldset>
</div>
</div>
<div class="kui-dialog__foot">
<button class="kui-button" data-kui-close="reset">Reset</button>
<button class="kui-button kui-button--primary" data-kui-close="apply">Show 128 invoices</button>
</div>
</dialog>
</kui-dialog>
Classes and attributes
.kui-dialog--sheet- A bottom sheet at every width: full width, rounded top corners, a handle, the safe area of the phone kept free.
.kui-dialog--sheet-phone- A normal dialog from 640 pixels up, a bottom sheet below. Combine it with --sm or --lg for the wide size.
data-kui-open, data-kui-close- Open and close it like any dialog.
Keyboard
- Tab or Shift + Tab
- Moves between the controls of the sheet. Focus does not leave it.
- Escape
- Closes the sheet.
Accessibility
- A sheet is a modal dialog: the same focus, inert background and labelling rules as the dialog apply.
- The handle is a picture only. Closing works by the close button, Cancel, Escape and a press on the dimmed page above.
- With reduced motion the sheet appears without sliding.
Do and do not
Do
- Use a sheet for a list of actions or a short form on a phone.
- Put the main action at the bottom, where the thumb is.
Do not
- Do not put a long form in a sheet; give it its own page.
- Do not rely on a swipe to close: there is none, and some people cannot swipe.