You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/components/form-components/InputGroup/InputGroupAddon.tsx

30 lines
656 B

import { ComponentType, PropsWithChildren } from 'react';
import clsx from 'clsx';
import { useInputGroupContext } from './InputGroup';
type BaseProps<TProps> = {
as?: ComponentType<TProps> | string;
required?: boolean;
};
export function InputGroupAddon<TProps>({
children,
as = 'span',
required,
...props
}: PropsWithChildren<BaseProps<TProps> & TProps>) {
useInputGroupContext();
const Component = as as 'span';
return (
<Component
className={clsx('input-group-addon', required && 'required')}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{children}
</Component>
);
}