12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667import React,{ ReactElement, useState }from"react";import{ Checkbox, Select }from"@react-md/form";import{
ConfigurableIcons,
IconProvider,
TextIconSpacing,
useIcon,}from"@react-md/icon";import{
ArrowDropDownSVGIcon,
CheckBoxSVGIcon,
ArrowDropDownFontIcon,}from"@react-md/material-icons";import{ Text }from"@react-md/typography";import{ Grid }from"@react-md/utils";// Note: If you want to enforce all icons should be updated, you can// switch to the `ConfiguredIcons` interface which is really just a// simple wrapper of `Required<ConfigurableIcons>`const overrides: ConfigurableIcons ={
checkbox:<CheckBoxSVGIcon/>,
dropdown:<ArrowDropDownSVGIcon/>,};functionPulledFromContext(): ReactElement {const icon =useIcon("dropdown");// I'm cheating a little bit for this demo, you probably shouldn't reference// the `rmd-text-icon-spacing` class name as it might be removed at some pointreturn(<divclassName="rmd-text-icon-spacing"><TextIconSpacingicon={icon}iconAfter><Text>Dropdown Icon</Text></TextIconSpacing></div>);}exportdefaultfunctionDemo(): ReactElement {const[value1, setValue1]=useState("");const[value2, setValue2]=useState("");return(<IconProvider{...overrides}><Gridclonecolumns={1}desktopColumns={2}><Selectid="select-1"label="Inherits"placeholder="Item..."options={Array.from({ length:10},(_, i)=>`Item ${i +1}`)}value={value1}onChange={(value)=>setValue1(value)}/><Selectid="select-2"label="Prop Overrides"placeholder="Item..."options={Array.from({ length:10},(_, i)=>`Item ${i +1}`)}value={value2}onChange={(value)=>setValue2(value)}rightChildren={<ArrowDropDownFontIcon/>}/><Checkboxid="checkbox-1"name="checkbox"label="Checkbox inherits"/><PulledFromContext/></Grid></IconProvider>);}