# Preferences

Supply UI 1.1.0. Helpers.

A choice the person makes once and keeps in their browser: list or grid view, an open sidebar. Not for settings that belong to the account or the site

Shows preferences on `data-*` attributes, so CSS styles by them from the first paint: global ones on `<html>`, the rest on its own element, which has `display: contents`. On the server it renders one inline script as its first child, which puts every saved value on its attribute as the page loads, before hydration. Content that reads a preference, through `usePreference`, catches up after hydration.

## Options

No options of its own.

It also takes the 281 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Helpers: notes

Hooks and functions the components are made of, passed on so a project uses the same ones: keyboard shortcuts, options loaded while typing, search matching, saved preferences, screen-reader announcements, smooth sizes, the theme.

**Do**
- Use `useShortcut` for app-wide keys, and show the key with `formatShortcut` so it reads right on each computer.
- Use `announce()` to tell a screen reader what changed when nothing visible takes focus ("3 results").

**Don't**
- Don't turn off the smooth sizes `Toaster` starts; boxes would jump when their content changes.
