Skip to content
Browse documentation
whisk/ui

Interaction and pseudo props

Style hover, focus, active, and disabled states with the same token language as the base component.

Interaction states

Whisk/UI utility props support _hover, _focus, and _active with the same static values as the base element.

Use a native Whisk/UI control when content performs an action. Pseudo props only describe how that control looks in a state; they do not create keyboard behavior, roles, or event handling.

import { Box, Text } from "@smoothie-framework/whisk-react";

export function SaveChangesControl() {
  return (
    <Box
      as="button"
      padding={3}
      background="surface2"
      border="sm"
      borderColor="border"
      rounded="md"
      _hover={{ background: "accentSubtle" }}
      _focus={{ borderColor: "borderFocus", shadow: "md" }}
      _active={{ background: "surface3" }}
    >
      <Text>Save changes</Text>
    </Box>
  );
}

Keyboard focus

Focus is part of an interactive component's contract, not decoration added after the behavior works.

  • Use Button, Link, inputs, and other semantic controls for interactive content.
  • Keep the focus treatment visible in both light and dark themes.
  • Do not use color as the only signal that a control has focus.

_focus compiles to :focus-visible:not(:disabled), so it normally does not apply when a pointer click focuses the element. Use it for a keyboard-visible treatment, not for every focused state.

Use the borderFocus token on a control that already has a border, then pair it with a focus shadow. This keeps the focus treatment within the supported utility props without changing the control's dimensions. _focus supplies both declarations. See the Accessibility foundation for contrast and focus-token guidance.

Pseudo props

Disabled, pressed, selected, and ARIA states belong to the component and application that own them.

Do not expect _disabled, _selected, or arbitrary selector props. For a finite custom state model, use a recipe with explicit selector conditions.