# SearchInput **📖 Live documentation:** https://cds.coinbase.com/components/inputs/SearchInput/ A control for searching a dataset. ## Import ```tsx import { SearchInput } from '@coinbase/cds-web/controls/SearchInput' ``` ## Examples ### Basic usage ```tsx live function BasicSearchInput() { const [value, setValue] = useState(''); return ( setValue('')} onSearch={(searchTerm) => console.log('Searching for:', searchTerm)} placeholder="Search..." /> Press Enter to trigger search ); } ``` ### Variants When `bordered={false}`, SearchInput keeps focused border styling disabled by default. Set `focusedBorderWidth` to opt into a focus border style. ```tsx live function SearchInputVariants() { const [value1, setValue1] = useState(''); const [value2, setValue2] = useState(''); const [value3, setValue3] = useState(''); const [value4, setValue4] = useState(''); return ( setValue1('')} placeholder="Compact search..." compact /> setValue2('')} placeholder="Borderless search (default focus behavior)..." bordered={false} /> setValue3('')} placeholder="Borderless search (with focus border)..." bordered={false} focusedBorderWidth={200} /> setValue4('')} placeholder="No icons..." hideStartIcon hideEndIcon /> ); } ``` ### With Custom End Element ```tsx live function CustomEndSearchInput() { const [value, setValue] = useState(''); return ( setValue('')} placeholder="Custom end element..." end={ console.log('Filter clicked')} />} /> ); } ``` ## Props | Prop | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `onChangeText` | `(text: string) => void` | Yes | `-` | - | | `align` | `center \| start \| end \| justify` | No | `start` | Text Align Input | | `alignContent` | `ResponsiveProp
` | No | `-` | - | | `alignItems` | `ResponsiveProp
` | No | `-` | - | | `alignSelf` | `ResponsiveProp
` | No | `-` | - | | `as` | `input` | No | `-` | The underlying element or component the polymorphic component will render. Changing as also changes the inherited native props (e.g. href for as=a) and the expected ref type. | | `aspectRatio` | `ResponsiveProp` | No | `-` | - | | `background` | `ResponsiveProp` | No | `-` | - | | `borderBottomLeftRadius` | `ResponsiveProp` | No | `-` | - | | `borderBottomRightRadius` | `ResponsiveProp` | No | `-` | - | | `borderBottomWidth` | `ResponsiveProp` | No | `-` | - | | `borderColor` | `ResponsiveProp` | No | `-` | - | | `borderEndWidth` | `ResponsiveProp` | No | `-` | - | | `borderRadius` | `ResponsiveProp` | No | `200` | Leverage one of the borderRadius styles we offer to round the corners of the input. | | `borderStartWidth` | `ResponsiveProp` | No | `-` | - | | `borderTopLeftRadius` | `ResponsiveProp` | No | `-` | - | | `borderTopRightRadius` | `ResponsiveProp` | No | `-` | - | | `borderTopWidth` | `ResponsiveProp` | No | `-` | - | | `borderWidth` | `ResponsiveProp` | No | `-` | - | | `bordered` | `boolean` | No | `true` | Add a border around all sides of the box. Adds border to input. When set to false, focus border styling is disabled by default. | | `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. | | `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. | | `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. | | `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. | | `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. | | `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. | | `bottom` | `ResponsiveProp>` | No | `-` | - | | `clearIconAccessibilityLabel` | `string` | No | `-` | Set the a11y label for the clear icon | | `color` | `ResponsiveProp` | No | `-` | - | | `columnGap` | `ResponsiveProp` | No | `-` | - | | `compact` | `boolean` | No | `false` | Enables compact variation | | `containerSpacing` | `string` | No | `-` | Custom container spacing if needed. This will add to the existing spacing | | `dangerouslySetBackground` | `string` | No | `-` | - | | `disabled` | `boolean` | No | `false` | Toggles input interactability and opacity | | `display` | `ResponsiveProp` | No | `-` | - | | `elevation` | `ResponsiveProp` | No | `-` | - | | `enableColorSurge` | `boolean` | No | `-` | Enable Color Surge motion | | `end` | `ReactNode` | No | `-` | Set the end node Adds content to the end of the inner input. Refer to diagram for location of endNode in InputStack component | | `flexBasis` | `ResponsiveProp>` | No | `-` | - | | `flexDirection` | `ResponsiveProp` | No | `-` | - | | `flexGrow` | `ResponsiveProp` | No | `-` | - | | `flexShrink` | `ResponsiveProp` | No | `-` | - | | `flexWrap` | `ResponsiveProp` | No | `-` | - | | `focusedBorderWidth` | `BorderWidth` | No | `-` | Additional border width when focused. Set this when bordered={false} to opt into a focus border style. | | `font` | `ResponsiveProp` | No | `-` | - | | `fontFamily` | `ResponsiveProp` | No | `-` | - | | `fontSize` | `ResponsiveProp` | No | `-` | - | | `fontWeight` | `ResponsiveProp` | No | `-` | - | | `gap` | `ResponsiveProp` | No | `-` | - | | `grid` | `ResponsiveProp` | No | `-` | - | | `gridArea` | `ResponsiveProp` | No | `-` | - | | `gridAutoColumns` | `ResponsiveProp>` | No | `-` | - | | `gridAutoFlow` | `ResponsiveProp` | No | `-` | - | | `gridAutoRows` | `ResponsiveProp>` | No | `-` | - | | `gridColumn` | `ResponsiveProp` | No | `-` | - | | `gridColumnEnd` | `ResponsiveProp` | No | `-` | - | | `gridColumnStart` | `ResponsiveProp` | No | `-` | - | | `gridRow` | `ResponsiveProp` | No | `-` | - | | `gridRowEnd` | `ResponsiveProp` | No | `-` | - | | `gridRowStart` | `ResponsiveProp` | No | `-` | - | | `gridTemplate` | `ResponsiveProp` | No | `-` | - | | `gridTemplateAreas` | `ResponsiveProp` | No | `-` | - | | `gridTemplateColumns` | `ResponsiveProp>` | No | `-` | - | | `gridTemplateRows` | `ResponsiveProp>` | No | `-` | - | | `height` | `ResponsiveProp>` | No | `-` | Height of input | | `helperText` | `ReactNode` | No | `-` | For cases where label is not enough information to describe what the text input is for. Can also be used for showing positive/negative messages | | `helperTextErrorIconAccessibilityLabel` | `string` | No | `'error'` | Accessibility label for helper text error icon when variant=negative | | `hideEndIcon` | `boolean` | No | `-` | hide the end icon | | `hideStartIcon` | `boolean` | No | `false` | hide the start icon | | `inputBackground` | `Color` | No | `'bg'` | Background color of the input. | | `inputNode` | `ReactElement` | No | `-` | Customize the element which the input area will be rendered as. Adds ability to render the input area as a