Boolean Values
β
Boolean Values
Boolean variables use simple true/false logic to control states, visibility, and interactivity. Theyβre one of the most powerful variable types in the Universal Design System (UDS) because they allow you to dynamically toggle layers, variants, and behaviors without needing to detach components or build redundant states.
We use Boolean properties extensively to support accessibility, clarity, and structured logic in our system. Hereβs how.
π§ What Boolean Variables Do
Boolean variables are used to:
Control the visibility of layers (e.g., icons, labels, error messages)
Switch between variant states like selected or expanded
Enable/disable interactivity or conditional styling
π Applied To:
Variant properties (e.g.
is-selected
,is-required
)Layer visibility toggles (e.g. icons or helper text inside a component)
Semantic toggles like expanded/collapsed, outlined/solid
Boolean properties allow for smart, logic-driven components that donβt rely on visuals alone.
π Common Boolean Properties in UDS
π¦ is-selected
is-selected
Used in toggles, pills, checkboxes, switches, and multiselect controls.
true
Component enters a selected or active state
false
Component is not selected, in its default state
Effects may include:
Displaying a checkmark icon
Changing color values for border/content/surface
Applying active/focus styles
π― Used in: Pills, switches, tab items, multiselect lists
π₯ is-required
is-required
Used for form components where user input is mandatory.
true
Component shows a red asterisk, validates for completion
false
Component is optional, no error is triggered if left empty
If is-required
is true
, and the component is not completed in a flow (like form submission), an error message must be shown with actionable feedback.
π§ͺ Used in: Input fields, form groups, checkboxes, textareas
π© is-expanded
is-expanded
Used in components with collapsible or toggled regions.
true
The hidden content region becomes visible
false
The region is collapsed or hidden
Typically toggles the visibility of:
Dropdown menus
Accordion content
Filter panels
Disclosure lists
π Used in: Accordions, dropdowns, expandable cards, filter sections
β οΈ Best Practices
Never hard-code visibility β use Booleans for conditional layers and semantics
Stack Booleans alongside other states like
hover
,active
, anddisabled
for robust behavior controlAlign Booleans with ARIA roles and expectations for accessibility parity
π§© Why It Matters
Boolean variables make components smarter, more semantic, and easier to test and maintain. They also reinforce accessibility best practices by ensuring that behavior (not just appearance) drives interaction.
Booleans turn visual components into logic-driven building blocks β a core principle of scalable, accessible design systems.
How to Add Visibility Toggle to Nested Components
Last updated
Was this helpful?