Select with Inset Label

A Material UI filled select dropdown whose label sits inside the field container, above the selected value. It always offers a leading "None" option and uses a Lucide ChevronDown icon.

Select with Inset Label
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @mui-treasury/select-inset-01

Requires @mui-treasury in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import * as React from 'react';import { SelectInset01 } from '@/src/mui-treasury/components/select-inset-01';export function Example() {  const [value, setValue] = React.useState('NONE');  return (    <SelectInset01      label="Country"      options={[        { value: 'jp', label: 'Japan' },        { value: 'us', label: 'United States' },      ]}      value={value}      onChange={(event) => setValue(event.target.value as string)}    />  );}
  • Use a compact form select where the field label should live inside the input container, as in modern filled-style forms.
  • Use when a dropdown needs a built-in "None" choice shown as an empty-state option.
  • Use for settings or filter forms built with Material UI that need a consistent bordered, filled look.
  • Avoid when you need multi-select or free-text entry, because this component only supports single-value selection from a fixed option list.

Examples

Controlled select with options

A controlled select that stores the chosen value in React state. The first item is the built-in "None" option, which uses the value NONE.

controlled-select-with-options.tsx
import * as React from 'react';import { SelectInset01 } from '@/src/mui-treasury/components/select-inset-01';export default function CountrySelect() {  const [value, setValue] = React.useState('NONE');  return (    <SelectInset01      label="Country"      options={[        { value: 'jp', label: 'Japan' },        { value: 'us', label: 'United States' },        { value: 'uk', label: 'United Kingdom' },      ]}      value={value}      onChange={(event) => setValue(event.target.value as string)}    />  );}

Non-full-width with form name and disabled

Sets fullWidth to false and passes the Material UI Select props name and disabled through the rest props.

non-full-width-with-form-name-and-disabled.tsx
import { SelectInset01 } from '@/src/mui-treasury/components/select-inset-01';export default function SizeSelect() {  return (    <SelectInset01      label="Size"      name="size"      disabled      fullWidth={false}      options={[        { value: 's', label: 'Small' },        { value: 'm', label: 'Medium' },      ]}      value="NONE"      onChange={() => {}}    />  );}

API reference

PropTypeDefaultDescription
labelstring—Text shown inside the field as the inset label. Required by the type. The source falls back to 'Select an option' when it is undefined at runtime.
optionsArray<{ value: string; label: string }>[]List of selectable items rendered as MenuItem elements after the built-in "None" option (value NONE).
valueunknown (Material UI SelectProps value)—Currently selected value. Pass the NONE value to show the empty "None" state.
onChange(event: SelectChangeEvent<unknown>, child: ReactNode) => void—Called when the user selects an item. Inherited from Material UI SelectProps.
fullWidthbooleantrueWhether the underlying FormControl spans the full width of its container.
...propsOmit<SelectProps, 'label'>—All other Material UI Select props (for example name, disabled, required, error, multiple) are forwarded to the Select. Note that variant, id, displayEmpty, IconComponent, and sx are set internally and then overridden by the spread.

Accessibility

  • The InputLabel is linked to the select through htmlFor and an id generated by React.useId(), so the label text is associated with the control.
  • The label always stays visible above the value as an inset label, so it is not removed when a value is selected.
  • The NONE option renders as an em element with the text "None", so screen readers announce an empty choice rather than a blank string.
  • Keyboard navigation, focus, and ARIA roles come from Material UI Select. Do not disable focus outlines with custom styles.
  • Keep the label text meaningful, because it is the only accessible name for the field.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Select with Inset Label" component (mui-treasury/select-inset-01) from its shadcn registry.1. Install it with: npx shadcn@latest add @mui-treasury/select-inset-012. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: label, options, value, onChange, fullWidth, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport * as React from 'react';import { SelectInset01 } from '@/src/mui-treasury/components/select-inset-01';export function Example() {  const [value, setValue] = React.useState('NONE');  return (    <SelectInset01      label="Country"      options={[        { value: 'jp', label: 'Japan' },        { value: 'us', label: 'United States' },      ]}      value={value}      onChange={(event) => setValue(event.target.value as string)}    />  );}```

Files & dependencies

  • components/select-inset-01/select-inset-01.tsx→ src/mui-treasury/components/select-inset-01/select-inset-01.tsx
  • components/select-inset-01/index.ts→ src/mui-treasury/components/select-inset-01/index.ts
dependencies@mui/materiallucide-react@emotion/react@emotion/styled

Looks similar, elsewhere