Skip to content

Theming ​

The default theme is neutral grey with no brand colour, so it fits most designs. Every colour and size is a CSS custom property.

Light and dark ​

flow-select uses the CSS light-dark() function, so the mode follows the element's color-scheme. The page decides, in any of these ways:

On the pageResult
NothingLight, even when the operating system is dark
color-scheme: dark in your CSSDark
data-bs-theme="dark" (Bootstrap 5.3)Dark
class="dark" on <html> (Tailwind and others)Dark
data-theme="dark"Dark
data-fs-theme="dark" or "light"Forced
data-fs-theme="auto"Follows the operating system

The attributes work on <html> or on any container, so one panel can be dark inside a light page. Toggle the theme of these docs (top right) to see the demos switch.

Custom properties ​

Set them on .fs, .fs-popover, select[data-flow-select] for every select, or on a container or a single wrapper for some. Include select[data-flow-select] so the plain select drawn before the script runs matches.

css
.fs, .fs-popover, select[data-flow-select] {
  --fs-accent: #2563eb;
  --fs-radius: 6px;
}

Use light-dark() to give different values per mode:

css
.fs, .fs-popover, select[data-flow-select] {
  --fs-chip-bg: light-dark(#dbeafe, #1e3a8a);
  --fs-chip-text: light-dark(#1e3a8a, #dbeafe);
}

Colours ​

PropertyUsed for
--fs-textText
--fs-mutedIcons, meta text, group headers
--fs-placeholderPlaceholder text
--fs-bgControl background
--fs-borderControl border
--fs-border-hoverControl border on hover
--fs-scrollbarList scrollbar thumb. Defaults to --fs-border
--fs-accentBorder when focused or open, highlighted chip outline
--fs-ringFocus ring (a box-shadow value)
--fs-ghost-bgGhost variant background
--fs-ghost-hoverGhost variant background on hover and while open
--fs-pop-bgList background
--fs-pop-borderList border
--fs-pop-shadowList shadow (a box-shadow value)
--fs-active-bgHighlighted row
--fs-chip-bgChip background
--fs-chip-textChip text
--fs-badge-bgBadge background
--fs-avatar-bgLetter avatar background
--fs-avatar-textLetter avatar text
--fs-descriptionDescription text
--fs-invalidBorder when invalid

Sizes and motion ​

PropertyDefaultUsed for
--fs-height2.5emControl height
--fs-pad-x.875emHorizontal padding
--fs-radius.5remControl corners
--fs-radius-pop.75remList corners
--fs-radius-item.4375remRow corners
--fs-pop-max-height20remMaximum list height
--fs-pop-min-width12remMinimum list width
--fs-duration90msOpen fade and colour transitions. 0s turns them off

Text size and font are inherited from the page, like a native input, so the list matches your site. Sizes are in em, so changing font-size on a select (or on a container) scales everything. Users who prefer reduced motion get no animation.

Classes ​

Add your own class to the wrapper with data-fs-class-name="my-select". The wrapper also carries state classes you can style:

ClassWhen
fs--field, fs--pill, fs--ghostVariant
fs--sm, fs--lgSize
fs--multipleMultiple select
is-openThe list is open
has-valueA value is chosen
has-queryText is typed in inline search
is-disabledDisabled
is-invalidFailed validation

Example: brand colour ​

css
.brand .fs, .brand .fs-popover, .brand select[data-flow-select] {
  --fs-accent: #673de6;
  --fs-ring: 0 0 0 3px rgb(103 61 230 / .2);
  --fs-chip-bg: light-dark(#ede9fe, #3b2f63);
  --fs-chip-text: light-dark(#4c1d95, #ddd6fe);
}

Released under the MIT License.