GridSelectGridSelect
Guide
Reference
Demo
npm
GitHub
Guide
Reference
Demo
npm
GitHub
  • Options
  • Attributes and hooks
  • Instance and events
  • CSS variables
  • Changelog
  • Contributing

CSS variables

The default stylesheet takes its colours and sizes from CSS custom properties, also called CSS variables, whose names start with --gs-. Changing a variable is the easiest way to adapt GridSelect to your design, because you do not need to know or override any of the stylesheet's rules.

Set a variable on :root to change every GridSelect on the page, or on one wrapper or any of its ancestors to change only the groups inside it. The stylesheet sits in the cascade layer gridselect, and themes sit in their own layers after it, so any rule you write outside a layer wins without !important. Light and dark mode follow the operating system through prefers-color-scheme; set data-theme="light" or data-theme="dark" on any ancestor to force one. The colour defaults below are those of the light mode; the dark mode uses its own values with the same contrast. See Styling and themes for more.

VariableWhatDefault (light)
--gs-bgPanel and field background#ffffff
--gs-item-bgItem background#f5f7fa
--gs-fgText#0e1117
--gs-mutedDimmed text, headings, descriptions#636b78
--gs-borderBorders (3:1)#7a8494
--gs-accentSelected background, focus and cursor ring#03a2a5
--gs-accent-fgText on the accent#0e1117
--gs-accent-textMatches in highlight mode#00787b
--gs-key-bgDigit badge#dce6ec
--gs-key-fgDigit badge text#0e1117
--gs-key-selected-bgBadge of a chosen item#8ed5d6
--gs-invalidInvalid field#b91c1c
--gs-shadowPanel shadow0 8px 30px rgb(0 13 26 / 0.12)
--gs-fontFontinherit
--gs-radiusItem corner radius999px
--gs-gapSpace between items0.5rem
--gs-item-min-heightItem height (at least 24 px)2rem
--gs-item-paddingItem padding0.25rem 0.75rem
--gs-item-min-widthSmallest grid column8rem
--gs-focus-widthFocus and cursor ring2px
--gs-panel-widthPanel width with panelWidth: "fixed"min(40rem, 100vw - 2rem)
--gs-panel-max-widthCap for the full-width panelnone
--gs-list-max-heightList height with panelHeight: "fixed"18rem
--gs-auto-widthSet by GridSelect: width of the widest itemmeasured

Themes set the same variables, plus a few rules of their own. If you change colours, keep the contrast that WCAG 2.2 AA requires: 4.5:1 for text against its background, and 3:1 for borders, focus outlines and the cursor.

Edit this page
Last Updated: 11/10/26, 4:41 PM
Contributors: Michael Grossklos, Claude Opus 5.5