Guides
Forms and appearance
Form submission through a hidden native select, reset, required, disabled and read-only states, clear buttons, styling hooks, RTL and texts of Select and Combobox.
Dropdown forms and appearance
Open demoA form with a placeholder, read-only and disabled fields, DOM attributes, submission and reset; styling through className, part maps and a theme seed; localized texts with plural counts; and a right-to-left chip field.
Forms
With name, a Select or Combobox renders a visually hidden native
<select> holding one selected option per value, so the value
submits with the form, appears in FormData, works before hydration, and
required uses native constraint validation; an invalid submit moves focus
to the visible control. Values are stringified with String(value).
form, id, autoFocus, aria-* and every other DOM prop reach the
focusable element. A reset of the owning form restores
defaultValue, reporting reason: 'reset'; a Combobox also
restores defaultInputValue and calls onInputChange with
reason: 'reset'.
import { Combobox } from '@salmonui/dropdowns/combobox';
import { Select } from '@salmonui/dropdowns/select';
import '@salmonui/dropdowns/combobox/styles.css';
import '@salmonui/dropdowns/select/styles.css';
<form action={save}>
<Select name="size" required data={['S', 'M', 'L']} />
<Combobox name="tags" multiple creatable data={tags} />
</form>
placeholder. There is no floating label: floating labels move layout on focus and need size and typography rules the theme does not expose. Use thelabelprop (below), a<label htmlFor>above the control (the trigger is a labelable button) oraria-labelledby.readOnlysetsaria-readonly; the popup does not open and the value is still submitted.disabledis the native attribute on the focusable element, so<fieldset disabled>disables it too, and the value is not submitted.clearableadds a clear button: defaultfalseonSelect,trueonCombobox. Clearing reportsreason: 'clear'; Delete or Backspace on a closedclearableSelect clear too.- No built-in persistence: no component writes to storage on
its own, since hidden storage writes break
SSR consistency. Store the value yourself:
value={saved} onValueChange={(next) => save(next)}. - One
value: several entry points for one state would need precedence rules, and an index goes stale whendatachanges. The text and position are derived from the item; to select the third item, passvalue={data[2].value}, and to select by text, pass the value of the matching item.
Labels, descriptions and errors
Select and Combobox take the field props of TextField, so they need
no wrapping Field or hand-written <label>:
<Select
label="Status"
description="Shown to the customer on the receipt."
errorMessage="Choose a status."
invalid={submitted && !status}
required
name="status"
data={statuses}
/>
labelrenders a<label>above the control and names it througharia-labelledby; the popup listbox is labelled by it too. Pressing the label focuses the control (it does not open the popup).descriptionrenders help text below the control;errorMessageshows below it whileinvalidis true. Both are listed in the control'saria-describedby(description first), andinvalidsetsaria-invalid(the red border).- The parts render only when one of them is set: the wrapper is
.salmon-dropdown-fieldwith.salmon-dropdown-field-label,-descriptionand-error(theTextFieldlayout and colors); without them the markup is the bare control, as before.classNameandstylestay on the control root (.salmon-select/.salmon-combobox). - Explicit props win:
aria-labelledby,aria-describedbyandaria-invalidprops replace the generated values (the visible parts still render). - Inside a
Field(@salmonui/inputs/form), let theFieldrender the label, description and error and pass itsinputProps(id,aria-describedby,aria-invalid,aria-errormessage) to the control; they pass through unchanged. Do not also setlabelhere, or the control is named by its own label instead of the Field's. AFormwithrequiredMarkmarks the label of arequiredSelect or Combobox as well.
Select and Combobox labels
Open demoA Select and a Combobox labelled, described and marked invalid through their own label, description and errorMessage props, without a wrapping Field or a hand-written label element.
Appearance
classNameandstylereach the root;classNames/stylesreach the partsroot,trigger,input,value,popup,list,option,group,chipandsearch. Width isstyleor a class.- Classes are
.salmon-select*,.salmon-combobox*and the shared popup.salmon-dropdown-*; states aredata-*attributes (data-open,data-active,data-selected,data-disabled) and colors come from the five theme seeds. Import@salmonui/dropdowns/select/styles.cssor@salmonui/dropdowns/combobox/styles.css(each includes the shared popup rules), or the package aggregate@salmonui/dropdowns/styles.css. - RTL follows the inherited
dir: logical CSS, the popup aligns to the inline start, and Left / Right among chips mirror. - Texts:
localeTextoverSELECT_DEFAULT_LOCALE_TEXT/COMBOBOX_DEFAULT_LOCALE_TEXT. Counts are functions of the number and itsIntl.PluralRulescategory inlocale(default'en-US', identical on server and client).
<Select multiple aria-label="Tags" valueDisplay="count" data={tags} localeText={{ selectedCount: (n, plural) => (plural === 'one' ? '1 Etikett' : `${n} Etiketten`) }} locale="de-DE" />