Blossom UI

Forms

Form controls: input, password input with a show and hide button, textarea, custom select, multi select with chips, checkbox, radio group and switch, with validation messages.

How to use it

Run npx @blossomui/react add forms, or copy src/components/UI/Forms/Forms.tsx into your React project and import it.

import { Input, PasswordInput, Textarea, Select, MultiSelect, Checkbox, Radio, RadioGroup, Switch } from './components/ui/Forms'

Props

FieldProps

PropTypeDescription
requiredbooleanMarks the field as required: an asterisk is shown next to the label.
colorstringAccent color of this field: any CSS color. Without it the field uses `--blossom-accent`, which is pink by default.
labelstring
hintstringHelper text shown under the field.
errorstringError message. Turns the field red.
successstringSuccess message. Turns the field green.

InputProps

PropTypeDescription
iconReactNodeIcon shown inside the field, on the left.
actionReactNodeContent shown inside the field, on the right, for example a small button.

PasswordInputProps

PropTypeDescription
showLabelstringAccessible name of the button while the password is hidden.
hideLabelstringAccessible name of the button while the password is visible.

SelectOption

PropTypeDescription
value (required)string
label (required)string
disabledboolean
imagestringImage shown before the label, for example a flag. It is decorative: the label names the option.

SelectProps

PropTypeDescription
options (required)SelectOption[]
valuestringControlled value. Use together with `onChange`.
defaultValuestringInitial value when the select is uncontrolled.
onChange(value: string) => void
placeholderstring
namestringAdds a hidden input with this name so the value is sent with native forms.
disabledboolean
classNamestring

MultiSelectProps

PropTypeDescription
noResultsLabelstringText shown when the search does not match any option.
options (required)SelectOption[]
valuestring[]Controlled list of selected values. Use together with `onChange`.
defaultValuestring[]
onChange(value: string[]) => void
placeholderstring
namestringAdds one hidden input per selected value so they are sent with native forms.
maxnumberMaximum number of values that can be selected.
disabledboolean
classNamestring

CheckboxProps

PropTypeDescription
label (required)string
descriptionstringSmaller text under the label.
indeterminatebooleanShows a dash instead of the check, for "some selected" states.
errorstringError message. It is shown in red under the label and marks the checkbox as invalid.

RadioProps

PropTypeDescription
label (required)string
descriptionstring

RadioGroupOption

PropTypeDescription
value (required)string
label (required)string
descriptionstring
disabledboolean

RadioGroupProps

PropTypeDescription
name (required)string
options (required)RadioGroupOption[]
valuestring
defaultValuestring
onChange(value: string) => void
direction'vertical' | 'horizontal'

SwitchProps

PropTypeDescription
label (required)string

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree