Skip to content

Hover, Focus & States

ISS implements Tailwind CSS v4’s full selector engine in Iced: interactive states, named group and peer combinators, structural child selectors, rendered pseudo-elements, ARIA/data attributes, RTL flipping, and media preferences.

Interactive Iced
Rust · WASM
Live interactive Rust Iced controls demonstrating hover:, active:, focus:, group-hover:, and disabled:
Hover, press, and click controls below to trigger live ISS state variants in Rust Iced

Stack variants in any order (for example dark:hover:bg-zinc-800 or disabled:opacity-50). Supported states include hover:, focus:, focus-visible:, focus-within:, active:, disabled:, enabled:, checked:, indeterminate:, required:, valid:, invalid:, in-range:, out-of-range:, placeholder-shown:, autofill:, read-only:, open:, inert:, visited:, and target:.

Mark an ancestor with group (or isolated group/card) and style descendants with group-hover:* or group-hover/card:*. Mark a preceding sibling with peer to drive peer-checked:* or peer-invalid:* styles. ISS also supports has-*, not-*, and in-*.

use iced::widget::text;
use iss::{col_tw, tw, TwExt};
let card = col_tw(
[
text("Project Alpha").tw(tw!(
"text-sm font-semibold text-zinc-100 group-hover/card:text-violet-300"
)),
text("Hover the card to highlight this label").tw(tw!(
"text-xs text-zinc-400 group-hover/card:text-zinc-200"
)),
],
tw!("group/card p-4 bg-zinc-900 hover:bg-zinc-800/80 border border-zinc-800 rounded-xl gap-1"),
);

Structural Selectors & Rendered Pseudo-Elements

Section titled “Structural Selectors & Rendered Pseudo-Elements”

Inside row_tw, col_tw, flex_tw, grid_tw, and list_tw, ISS evaluates first:, last:, only:, odd:, even:, nth-*, empty:, direct-child *:*, and descendant **:*. Pseudo-element prefixes (before:, after:, placeholder:, marker:, first-line:, and first-letter:) render directly alongside your widget.

use iced::widget::{container, text};
use iss::{tw, TwExt};
let callout = container(text("Verified build").tw(tw!("text-sm text-zinc-100")))
.tw(tw!(
"relative pl-4 py-2 pr-3 bg-zinc-900 rounded-lg overflow-hidden before:absolute before:inset-y-0 before:left-0 before:w-1 before:bg-violet-500"
));

ARIA, Data Attributes, RTL & Media Preferences

Section titled “ARIA, Data Attributes, RTL & Media Preferences”
Category Supported Prefixes Runtime Source
ARIA attributes aria-expanded:, aria-selected:, aria-checked:, aria-[sort=ascending]: IssNodeState::with_aria / SelectorEvalContext
Data attributes data-active:, data-[state=open]:, group-data-[...]:, peer-data-[...]: IssNodeState::with_data
Directionality rtl:, ltr: + automatic W3C logical flipping (ps/pe, ms/me, rounded-s/e, border-s/e) dir_rtl(...), dir_ltr(...), or IssViewport::rtl()
Media preferences motion-safe:, motion-reduce:, contrast-more:, contrast-less:, forced-colors:, portrait:, landscape: IssViewport::with_reduced_motion / with_contrast