Elements are the controls a reader works with: buttons and form fields. They need no class. Inside .rd a bare <button>, <input>, <select> or <textarea> takes the library's look; outside it, a host's own controls stay as the host made them.
<input type="text" placeholder="Search the docs">
<button type="button">Search</button>
<button class="button-primary" type="button">Subscribe</button>
Three rules
- Elements first, classes on top
- The element has the default look; a variant, a size or a layout is a class on top of it (
.button-primary,.button-sm,.form-group)..buttongives a link the button look. - One height
- A button and a text field of the default size are equally tall, so they line up in a row with no extra work.
- Any class wins
- The element defaults have type weight in every state, hover and focus included. A component that styles its own
<button>(a carousel arrow, a legend toggle) overrides them with one class and never fights a:hover.
A RareCharts card (.rc-chart) draws its own controls, so the element defaults stop at it. That includes the page's own controls a chart moves into its controls row: they keep the chart's compact look.
Links
A text link is underlined in --brand-color-dark. On hover a soft fill of the same colour rises from the bottom of the line. With reduced motion it appears without the animation.
A paragraph with a text link in it, and a thicker link with .link-thick.
At rest a link has exactly one line, the underline. Until v0.7.0 the hover fill sat at rest as a 1px strip just below the text box. Chrome clipped it, but Safari showed it as a second, lighter underline.
Links that are not text links (icons, cards, logos) take .no-decoration.
Keyboard focus
Every focusable element inside .rd (links, buttons, form fields, summary, carousel controls) shows the same ring when it is reached from the keyboard. The rule is :focus-visible, so the browser decides when to show it: clicking a link or a button shows no ring, while clicking into a text field does, because typing follows. Press Tab on this page to see it.
The ring is 2px of --focus-ring-color, offset by 2px. The default follows --signal (--blue) and keeps at least 3:1 contrast on every library surface, light and dark. Restyle it with the tokens; don't remove it.
:root {
--focus-ring-color: var(--signal);
--focus-ring-width: 2px;
--focus-ring-offset: 2px;
}
On macOS, Safari moves Tab only between form fields unless "Press Tab to highlight each item on a webpage" is enabled (Safari → Settings → Advanced); Option+Tab reaches links and buttons either way. Firefox follows the system setting "Keyboard navigation" (System Settings → Keyboard).