v2.1.8
/
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Layout
  • App
  • Container
  • Error
  • SidebarLayout
  • Element
  • Advice
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Banner
  • Button
  • Calendar
  • Card
  • Chip
  • Collapsible
  • Countdown
  • FieldGroup
  • Kbd
  • Progress
  • Separator
  • Skeleton
  • Form
  • Checkbox
  • CheckboxGroup
  • ColorPicker
  • FileUpload
  • Form
  • FormField
  • Input
  • InputDate
  • InputMenu
  • InputNumber
  • InputTags
  • InputTime
  • PinInput
  • RadioGroup
  • Range
  • Select
  • SelectMenu
  • Switch
  • Textarea
  • Data
  • Accordion
  • DescriptionList
  • Empty
  • Table
  • TableWrapper
  • Timeline
  • User
  • Navigation
  • Breadcrumb
  • CommandPalette
  • Link
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Overlay
  • ContextMenu
  • DropdownMenu
  • Modal
  • Popover
  • Slideover
  • Toast
  • Tooltip
  • Page
  • PageCard
  • PageColumns
  • PageGrid
  • PageLinks
  • PageList
  • Dashboard
  • DashboardGroup
  • DashboardSearch
  • DashboardSearchButton
  • AI Chat
  • soonChatMessage
  • soonChatMessages
  • soonChatPalette
  • soonChatPrompt
  • soonChatPromptSubmit
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • Docs
  • Components
  • Composables
  • Typography

ColorModeSelect

A Select to switch between system, dark & light mode.
GitHub
SelectMenu
Demo
Nuxt UI

Usage

The ColorModeSelect component extends the SelectMenu component, so you can pass any property such as color, size, etc.

{
  "wait": "Loading client-side content..."
}

API

Props

Prop Default Type
defaultOpenboolean

The open state of the combobox when it is initially rendered.
Use when you do not need to control its open state.

openboolean

The controlled open state of the Combobox. Can be binded with with v-model:open.

trailingIconicons.chevronDownIconComponent

The icon displayed to open the menu.

trailingboolean

When true, the icon will be displayed on the right side.

content{ side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' } ComboboxContentProps & Partial<EmitsToProps<DismissableLayerEmits>>

The content of the menu.

  • position?: "inline" | "popper"

    The positioning mode to use,
    inline is the default and you can control the position using CSS.
    popper positions content in the same way as our other primitives, for example Popover or DropdownMenu.

  • bodyLock?: boolean

    The document.body will be lock, and scrolling will be disabled.

  • side?: "top" | "bottom" | "right" | "left"

    The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled. Defaults to "top".

  • sideOffset?: number

    The distance in pixels from the trigger. Defaults to 0.

  • sideFlip?: boolean

    Flip to the opposite side when colliding with boundary. Defaults to true.

  • align?: "start" | "center" | "end"

    The preferred alignment against the trigger. May change when collisions occur. Defaults to "center".

  • alignOffset?: number

    An offset in pixels from the start or end alignment options. Defaults to 0.

  • alignFlip?: boolean

    Flip alignment when colliding with boundary. May only occur when prioritizePosition is true. Defaults to true.

  • avoidCollisions?: boolean

    When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to true.

  • collisionBoundary?: Element | (Element | null)[] | null

    The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check. Defaults to [].

  • collisionPadding?: number | Partial<Record<"top" | "bottom" | "right" | "left", number>>

    The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }. Defaults to 0.

  • arrowPadding?: number

    The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.

  • sticky?: "partial" | "always"

    The sticky behavior on the align axis. partial will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".

  • hideWhenDetached?: boolean

    Whether to hide the content when the trigger becomes fully occluded. Defaults to false.

  • positionStrategy?: "absolute" | "fixed"

    The type of CSS position property to use.

  • updatePositionStrategy?: "always" | "optimized"

    Strategy to update the position of the floating element on every animation frame. Defaults to 'optimized'.

  • disableUpdateOnLayoutShift?: boolean

    Whether to disable the update position for the content when the layout shifted. Defaults to false.

  • prioritizePosition?: boolean

    Force content to be position within the viewport.

    Might overlap the reference element, which may not be desired. Defaults to false.

  • reference?: ReferenceElement

    The custom element or virtual element that will be set as the reference to position the floating element.

    If provided, it will replace the default anchor element.

  • disableOutsidePointerEvents?: boolean

    When true, hover/focus/click interactions will be disabled on elements outside the DismissableLayer. Users will need to click twice on outside elements to interact with them: once to close the DismissableLayer, and again to trigger the element.

  • onEscapeKeyDown?: ((event: KeyboardEvent) => void)
  • onPointerDownOutside?: ((event: PointerDownOutsideEvent) => void)
  • onFocusOutside?: ((event: FocusOutsideEvent) => void)
  • onInteractOutside?: ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void)
loadingboolean

When true, the loading icon will be displayed.

size'md' "md" | "xs" | "sm" | "lg" | "xl" | "xss"
avatar AvatarProps

Display an avatar on the left side.

  • as?: any

    The element or component this component should render as. Defaults to 'span'.

  • src?: string
  • alt?: string
  • icon?: IconComponent

    Display an icon on the left side.

  • text?: string
  • size?: "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl"

    Defaults to 'md'.

  • chip?: boolean | ChipProps
  • class?: any
  • style?: any
  • b24ui?: { root?: ClassNameValue; image?: ClassNameValue; fallback?: ClassNameValue; icon?: ClassNameValue; }
  • crossorigin?: "" | "anonymous" | "use-credentials"
  • decoding?: "async" | "auto" | "sync"
  • height?: Numberish
  • loading?: "lazy" | "eager"
  • referrerpolicy?: HTMLAttributeReferrerPolicy
  • sizes?: string
  • srcset?: string
  • usemap?: string
  • width?: Numberish
color'air-primary'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot"
autofocusboolean
disabledboolean

When true, prevents the user from interacting with listbox

name string

The name of the field. Submitted with its owning form as part of a name/value pair.

roundedfalseboolean

Rounds the corners of the select

resetSearchTermOnBlur`true`boolean

Whether to reset the searchTerm when the Combobox input blurred

resetSearchTermOnSelect`true`boolean

Whether to reset the searchTerm when the Combobox value is selected

highlightOnHoverboolean

When true, hover over item will trigger highlight

defaultValuecolor?: "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "null" | "string" | "number" | "bigint" | "false" | "true" | "{ [key: string]: any; label?: string ; description?: string" | "undefined; icon?: IconComponent" | "undefined; avatar?: AvatarProps" | "undefined; air-primary" | "undefined; chip?: ChipProps" | "undefined; type?: item" | "label" | "separator" | "undefined; disabled?: boolean" | "undefined; onSelect?: ((e: Event) => void)" | "undefined; class?: any; b24ui?: Pick<{ root?: ClassNameValue; base?: ClassNameValue; leading?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; trailing?: ClassNameValue; trailingIcon?: ClassNameValue; tag?: ClassNameValue; value?: ClassNameValue; placeholder?: ClassNameValue; content?: ClassNameValue; viewport?: ClassNameValue; arrow?: ClassNameValue; group?: ClassNameValue; empty?: ClassNameValue; label?: ClassNameValue; separator?: ClassNameValue; item?: ClassNameValue; itemLeadingIcon?: ClassNameValue; itemLeadingAvatar?: ClassNameValue; itemLeadingAvatarSize?: ClassNameValue; itemLeadingChip?: ClassNameValue; itemLeadingChipSize?: ClassNameValue; itemTrailing?: ClassNameValue; itemTrailingIcon?: ClassNameValue; itemWrapper?: ClassNameValue; itemLabel?: ClassNameValue; itemDescription?: ClassNameValue; input?: ClassNameValue; focusScope?: ClassNameValue; }, item" | "label" | "separator" | "itemLeadingIcon" | "itemLeadingAvatar" | "itemLeadingAvatarSize" | "itemLeadingChip" | "itemLeadingChipSize" | "itemTrailing" | "itemTrailingIcon" | "itemWrapper" | "itemLabel" | "itemDescription>" | "undefined; }"

The value of the SelectMenu when initially rendered. Use when you do not need to control the state of the SelectMenu.

  • label?: string
  • description?: string
  • icon?: IconComponent

    Display an icon on the left side.

  • avatar?: AvatarProps
  • color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot"
  • chip?: ChipProps
  • type?: "item" | "label" | "separator"

    The item type. Defaults to 'item'.

  • disabled?: boolean
  • onSelect?: ((e: Event) => void)
  • class?: any
  • b24ui?: Pick<{ root?: ClassNameValue; base?: ClassNameValue; leading?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; trailing?: ClassNameValue; trailingIcon?: ClassNameValue; tag?: ClassNameValue; value?: ClassNameValue; placeholder?: ClassNameValue; content?: ClassNameValue; viewport?: ClassNameValue; arrow?: ClassNameValue; group?: ClassNameValue; empty?: ClassNameValue; label?: ClassNameValue; separator?: ClassNameValue; item?: ClassNameValue; itemLeadingIcon?: ClassNameValue; itemLeadingAvatar?: ClassNameValue; itemLeadingAvatarSize?: ClassNameValue; itemLeadingChip?: ClassNameValue; itemLeadingChipSize?: ClassNameValue; itemTrailing?: ClassNameValue; itemTrailingIcon?: ClassNameValue; itemWrapper?: ClassNameValue; itemLabel?: ClassNameValue; itemDescription?: ClassNameValue; input?: ClassNameValue; focusScope?: ClassNameValue; }, "item" | "label" | "separator" | "itemLeadingIcon" | "itemLeadingAvatar" | "itemLeadingAvatarSize" | "itemLeadingChip" | "itemLeadingChipSize" | "itemTrailing" | "itemTrailingIcon" | "itemWrapper" | "itemLabel" | "itemDescription">
multiple false

Whether multiple options can be selected or not.

requiredfalseboolean
id string
placeholder string

The placeholder text when the select is empty.

searchInputfalseboolean | InputProps<AcceptableValue>

Whether to display the search input or not. Can be an object to pass additional props to the input. { placeholder: 'Search...', type: 'text', size: 'md' }

noPaddingfalseboolean

Removes padding from input

noBorderfalseboolean

Removes all borders (rings)

underlinefalseboolean

Removes all borders (rings) except the bottom one

tag string
tagColor'air-primary'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection"
selectedIconicons.checkIconComponent

The icon displayed when an item is selected.

arrowfalseboolean | ComboboxArrowProps

Display an arrow alongside the menu.

portaltrue string | false | true | HTMLElement

Render the menu in a portal.

virtualizefalseboolean | { overscan?: number ; estimateSize?: number | undefined; } | undefined

Enable virtualization for large lists. Note: when enabled, all groups are flattened into a single list due to a limitation of Reka UI (https://github.com/unovue/reka-ui/issues/1885).

  • overscan?: number

    Number of items rendered outside the visible area Defaults to 12.

  • estimateSize?: number

    Estimated size (in px) of each item Defaults to 32.

valueKeyundefinedundefined

When items is an array of objects, select the field to use as the value instead of the object itself.

labelKey'label' string | number

When items is an array of objects, select the field to use as the label.

descriptionKey'description' string | number

When items is an array of objects, select the field to use as the description.

highlightboolean

Highlight the ring color like a focus state.

createItemfalseboolean | "always" | { position?: "top" | "bottom" ; when?: "empty" | "always" | undefined; } | undefined

Determines if custom user input that does not exist in options can be added.

  • position?: "top" | "bottom"
  • when?: "empty" | "always"
filterFields[labelKey] string[]

Fields to filter items by.

ignoreFilterfalseboolean

When true, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).

autofocusDelay number
b24ui { root?: ClassNameValue; base?: ClassNameValue; leading?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; trailing?: ClassNameValue; trailingIcon?: ClassNameValue; tag?: ClassNameValue; value?: ClassNameValue; placeholder?: ClassNameValue; content?: ClassNameValue; viewport?: ClassNameValue; arrow?: ClassNameValue; group?: ClassNameValue; empty?: ClassNameValue; label?: ClassNameValue; separator?: ClassNameValue; item?: ClassNameValue; itemLeadingIcon?: ClassNameValue; itemLeadingAvatar?: ClassNameValue; itemLeadingAvatarSize?: ClassNameValue; itemLeadingChip?: ClassNameValue; itemLeadingChipSize?: ClassNameValue; itemTrailing?: ClassNameValue; itemTrailingIcon?: ClassNameValue; itemWrapper?: ClassNameValue; itemLabel?: ClassNameValue; itemDescription?: ClassNameValue; input?: ClassNameValue; focusScope?: ClassNameValue; }

ColorModeImage

An image element with a different source for light and dark mode.

ColorModeSwitch

A switch to toggle between light and dark mode.

On this page

  • Usage
  • API
    • Props
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24