@emotion/react#ClassNames TypeScript Examples
The following examples show how to use
@emotion/react#ClassNames.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactSelectCustomization.tsx From ke with MIT License | 6 votes |
function SingleValue<OptionType>({ ...props }: SingleValueProps<OptionType>): JSX.Element {
const { singleValue } = useStyles()
const { className, isDisabled } = props
const theme = useTheme()
return (
<ClassNames>
{({ cx: emotionCx, css }) => (
<selectComponents.SingleValue
{...props}
className={emotionCx(className, {
[css(chakraCss((singleValue as any)?._disabled)(theme))]: isDisabled,
})}
/>
)}
</ClassNames>
)
}
Example #2
Source File: ReactSelectCustomization.tsx From ke with MIT License | 6 votes |
export function MultiValue<OptionType>(props: MultiValueProps<OptionType>): JSX.Element {
const { children, className, cx, getStyles, innerProps, isDisabled, removeProps, data, selectProps } = props
const { multiValueContainer, multiValueLabel, multiValueRemove } = useStyles()
const externalClassName = (selectProps as ExtendedProps).componentsClasses?.MultiValue
return (
<ClassNames>
{({ css, cx: emotionCx }) => (
<Tag data={data} sx={multiValueContainer} {...innerProps} className={classNames(className, externalClassName)}>
<TagLabel sx={multiValueLabel} className={className}>
{children}
</TagLabel>
<TagCloseButton
className={emotionCx(
css(getStyles('multiValueRemove', props)),
cx(
{
'multi-value__remove': true,
},
className
)
)}
isDisabled={isDisabled}
{...removeProps}
sx={multiValueRemove}
/>
</Tag>
)}
</ClassNames>
)
}