🎨
Valence
🎨
Valence
  • Overview
    • 👋Welcome to Valence
    • 🏄‍♂️Getting started
  • Core Concepts
    • Responsiveness
    • Color
      • List of colors
      • Color types
    • Polymorphism
  • Valence Core
    • 🏃‍♂️Fundamentals
      • 🎬The ValenceProvider
      • ✍️Using custom fonts
    • 🧱Components
      • 🔘Buttons
        • Button with icon
        • Grid Button
        • Text button
        • Icon button
        • Multi-part button
        • Unstyled button
        • Primitive button
      • ⌨️Inputs
        • Color Picker
        • Text input
        • Text area
        • Number input
        • Select input
        • Switch
        • Slider
        • Range slider
        • Pill selector
        • Input container
        • Dropdown container
      • 🖥️Display
        • Accordion
        • Alert
        • Color Swatch
        • Icon
        • Image
        • Avatar
        • Avatar Group
        • Loader
        • Pill
        • Spoiler
        • Stepper
        • Text
        • Title
      • 🧩Layout
        • App Container
        • Card
        • Flex
          • Flex Center
          • Styled Flex
        • Floating Toolbar
        • Grid
        • Header
        • Overflow Container
        • Space
      • 🗺️Navigation
        • App Nav
      • 🔼Overlays
        • Modal
        • Tooltip
        • Modal background
        • 📰Sheets
          • Bottom Sheet
          • Dynamic Sheet
          • Side Sheet
    • 🪝Hooks
      • UseColorScheme
      • UseColors
      • UseControlledList
      • UseDetectKeyDown
      • UseDisclosure
      • UseFloating
      • UseTooltip
      • UseBreakpoint
      • UseResponsiveProps
    • 🤚Generics
      • Generic button props
      • Generic input props
      • Generic Sheet Props
  • Valence Plugins
    • 🎠Valence Carousel
      • Carousel Child Props
  • Valence Utils
    • ✋Generics
      • Clickable
      • Events
      • Global
      • Grid
      • Layout
      • Overlay
      • Polymorphic
    • 🧜‍♀️Polymorphism
      • Polymorphic Button
      • Polymorphic Layout
      • Polymorphic Text
  • Update Notes
    • 3.0.0
    • 2.7.0
    • 2.6.0
    • 2.5.0
    • 2.4.0
    • 2.3.0
    • 2.2.0
    • 2.1.0
    • 2.0.0
Powered by GitBook
On this page
  • Usage
  • Props
  • DropdownContainerEventProps

Was this helpful?

Edit on GitHub
  1. Valence Core
  2. Components
  3. Inputs

Dropdown container

Last updated: 2.0.0 (18/01/2024)

PreviousInput containerNextDisplay

Last updated 1 year ago

Was this helpful?

This is a foundational component and is not designed to be used by itself. Only use this if you intend to make your own inputs.

The Dropdown container is used to create dropdowns, and handles most of the styling and dropdown logic for the .

Under the hood, this component is a wrapper around the , with additional components provided by to create the dropdown itself.

Usage

import { DropdownContainer } from "@valence-ui/core";

function MyComponent() { 

    return ( 
        <DropdownContainer 
            options={["hello", "world"]}        
            // For brevity, most suggested props
            // are not included.
        >
            // Your sub-component here.
            // It should have little to no styling,
            // as this is passed to the InputContainer.
        </DropdownContainer>
    )
}

If no children are supplied, a Text component rendering the selected option or a placeholder will be shown instead.

Props

Property
Type
Description

options (required)

Option[]

A list of options to display.

placeholder

string

The placeholder text to display when no option is selected.

selected

number | null

The currently selected option.

setSelected

(option: number | null) => void

A callback to set the selected option.

highlighted

number | null

The currently highlighted option.

setHighlighted

(option: number | null) => void

A callback to set the highlighted option.

icon

ReactNode

An icon to display in the input container.

secondaryIcon

ReactNode

A secondary icon to display in the input container.

dropdownStyle

CSSProperties

Optional styles to pass to the dropdown.

DropdownContainerEventProps

Property
Type
Description

onSelect

(option: Option) => void

A callback fired when an item is selected.

Extends and .

🧱
⌨️
Select input
Input container
Floating UI
InputContainerProps
DropdownContainerEventProps