Show design guidelines
A flexible select component supporting single/multi-select, search, async loading,
and creatable options. Compatible with react-select, select2, and mat-select patterns.
Framework HTML React Angular
Option 1
Option 2
Option 3
Option 1
Option 2
Option 3
Option 1
Option 2
Option 3
Option 4
Draft New
In Review Pending
Approved Complete
Rejected Action Required
The best way to render dynamic option labels in react is to use the renderOptionHtml prop. Use this function to return an HTML string which will be injected into the select options. Note: this MUST be a plain string, not JSX.
import React, {useState} from ' react ' ;
import {CertaraSelect, CertaraButton} from ' @certara/certara-ui-react ' ;
function optionHtml ( option ) {
return `<div> ${ option.label } <certara-badge>value: ${ option.value } </certara-badge></div>` ;
function generateRandomOption () {
value : Math. random (). toString ( 36 ). slice ( 2 , 8 ),
label : `Option ${ Math. floor (Math. random () * 1000 ) } ` ,
export default function DynamicSelectOptionsExample () {
const [items, setItems] = useState ([
{value : ' 1 ' , label : ' Option 1 ' },
{value : ' 2 ' , label : ' Option 2 ' },
{value : ' 3 ' , label : ' Option 3 ' },
setItems ([ generateRandomOption (), generateRandomOption (), generateRandomOption ()]);
< CertaraSelect searchable options ={ items } renderOptionHtml ={ optionHtml } className = " flex-1 " ></ CertaraSelect >
< CertaraButton onCertaraClick ={ updateItems } className = " ml-2 " >
Another possible, yet not recommended, way to render dynamic options is to use a key on the CertaraSelect component that changes whenever the options change. This forces react to unmount and remount the CertaraSelect component. Admittedly, this is not performant and should be avoided unless absolutely necessary.
import React, {useState} from ' react ' ;
import {CertaraSelect, CertaraSelectOption, CertaraButton, CertaraBadge} from ' @certara/certara-ui-react ' ;
function generateRandomOption () {
value : Math. random (). toString ( 36 ). slice ( 2 , 8 ),
label : `Option ${ Math. floor (Math. random () * 1000 ) } ` ,
export default function DynamicSelectOptionsKeyExample () {
const [items, setItems] = useState ([
{value : ' 1 ' , label : ' Option 1 ' },
{value : ' 2 ' , label : ' Option 2 ' },
{value : ' 3 ' , label : ' Option 3 ' },
setItems ([ generateRandomOption (), generateRandomOption (), generateRandomOption ()]);
< CertaraSelect key ={ items. map (( item ) => item.value). join ( ' , ' ) } searchable className = " flex-1 " >
< CertaraSelectOption key ={ item.value } value ={ item.value } >
{ item.label } < CertaraBadge >value: { item.value } </ CertaraBadge >
< CertaraButton onCertaraClick ={ updateItems } className = " ml-2 " >
ariaLabel
Attribute aria-labelType stringDefault nullRequired falseDescription Accessible label for the select (use when not inside a form-group)
async
Attribute asyncType booleanDefault falseRequired falseDescription Enable async loading mode
asyncConfig
Attribute undefinedType SelectAsyncConfigDefault undefinedRequired falseDescription Async configuration options
clearable
Attribute clearableType booleanDefault trueRequired falseDescription Allow clearing the selection
closeOnSelect
Attribute close-on-selectType booleanDefault undefinedRequired falseDescription Close menu after selecting (default: true for single, false for multi)
creatable
Attribute creatableType booleanDefault falseRequired falseDescription Allow creating new options
creatableConfig
Attribute undefinedType SelectCreatableConfigDefault undefinedRequired falseDescription Creatable configuration options
defaultValue
Attribute default-valueType (string | number)[] | number | stringDefault nullRequired falseDescription Default value to restore on form reset
disabled
Attribute disabledType booleanDefault falseRequired falseDescription Whether the control is disabled
error
Attribute errorType stringDefault ''Required falseDescription Error message to display
filterFn
Attribute undefinedType (option: SelectOption<unknown>, query: string) => booleanDefault undefinedRequired falseDescription Custom filter function
labelField
Attribute label-fieldType stringDefault 'label'Required falseDescription Label field name if options are objects
loading
Attribute loadingType booleanDefault falseRequired falseDescription Show a loading indicator
Attribute max-menu-heightType numberDefault 300Required falseDescription Maximum height of dropdown menu in pixels
Attribute menu-portal-targetType boolean | stringDefault undefinedRequired falseDescription Renders the dropdown menu into another DOM node. Selects the HTML element using its id. If the id can’t be found, defaults to the body.
Attribute menu-widthType numberDefault undefinedRequired falseDescription Maximum width of the dropdown menu in pixels. Use this to allow the menu to be wider than the trigger. The minimum width is the width of the trigger.
minSearchChars
Attribute min-search-charsType numberDefault 0Required falseDescription Minimum characters before filtering
multiple
Attribute multipleType booleanDefault falseRequired falseDescription Enable multiple selection mode
name
Attribute nameType stringDefault ''Required falseDescription The name of the control for form submission
options
Attribute undefinedType SelectOption<unknown>[] | SelectOptionGroup<unknown>[]Default []Required falseDescription Options array - can be flat or grouped
placeholder
Attribute placeholderType stringDefault 'Select...'Required falseDescription Placeholder text when no option is selected
placement
Attribute placementType "auto" | "bottom-end" | "bottom-start" | "top-end" | "top-start"Default 'bottom-start'Required falseDescription Preferred dropdown placement
readonly
Attribute readonlyType booleanDefault falseRequired falseDescription Whether the control is read-only
renderOptionHtml
Attribute undefinedType (option: SelectOption<unknown>) => stringDefault undefinedRequired falseDescription Custom render function for option HTML. This function should return a valid HTML string that will be injected into the select option. NOTE: this MUST be a plain string, not JSX.
required
Attribute requiredType booleanDefault falseRequired falseDescription Whether the control is required for form validation
searchable
Attribute searchableType booleanDefault falseRequired falseDescription Enable search/filtering
size
Attribute sizeType "lg" | "md" | "sm"Default 'md'Required falseDescription Size variant of the control
value
Attribute valueType (string | number)[] | number | stringDefault nullRequired falseDescription Current selected value(s)
valueField
Attribute value-fieldType stringDefault 'value'Required falseDescription Value field name if options are objects
variant
Attribute variantType "default" | "link"Default 'default'Required falseDescription Visual variant of the control
Name Description Bubbles certaraBlurEmitted on blur truecertaraChangeEmitted when the value changes truecertaraCloseEmitted when the dropdown closes falsecertaraCreateEmitted when a new option is created truecertaraFocusEmitted on focus truecertaraFormControlErrorEmitted for form control errors truecertaraLoadEmitted when async options should be loaded truecertaraOpenEmitted when the dropdown opens truecertaraSearchEmitted when the search query changes true
Name Signature Description addOption(option: SelectOption) => Promise<void>Adds an option to the list clear() => Promise<void>Clears the current selection close() => Promise<void>Closes the dropdown menu open() => Promise<void>Opens the dropdown menu removeOption(value: string | number) => Promise<void>Removes an option from the list setBlur() => Promise<void>Removes focus from the control setFocus() => Promise<void>Sets focus to the control setValue(value: SelectValue) => Promise<void>Sets the value programmatically
Name Description Default slot for declarative certara-select-option and certara-select-optgroup elements no-optionsCustom content when no options are available prefixContent to show before the selected value (e.g., an icon)
A single option within a certara-select dropdown.
Can be used declaratively or options can be passed programmatically.
data
Attribute undefinedType { [x: string]: unknown; }Default undefinedRequired falseDescription Arbitrary data to attach to this option.
disabled
Attribute disabledType booleanDefault falseRequired falseDescription Whether this option is disabled and cannot be selected.
highlighted
Attribute highlightedType booleanDefault falseRequired falseDescription Internal: Whether this option is currently highlighted via keyboard navigation.
html
Attribute htmlType stringDefault undefinedRequired falseDescription HTML content for rich option rendering (e.g., with badges). When provided, this is rendered instead of the label text.
label
Attribute labelType stringDefault undefinedRequired falseDescription The display label for this option. If not provided, uses slot content.
selected
Attribute selectedType booleanDefault falseRequired falseDescription Internal: Whether this option is currently selected.
value
Attribute valueType number | stringDefault undefinedRequired falseDescription The value of this option. Must be unique within the select.
Name Description Bubbles certaraOptionSelectEmitted when this option is clicked/selected. true
There are no public methods available for this component
Name Description The label content for the option
A group of options within a certara-select dropdown.
Provides a visual grouping with a label header.
disabled
Attribute disabledType booleanDefault falseRequired falseDescription Whether all options in this group are disabled.
label
Attribute labelType stringDefault undefinedRequired falseDescription The label displayed as the group header.
There are no events available for this component
There are no public methods available for this component
Name Description The option elements within this group