2023-05-31 03:08:41 +00:00
|
|
|
import { ComponentType, PropsWithChildren } from 'react';
|
2021-11-23 05:16:50 +00:00
|
|
|
|
|
|
|
import { useInputGroupContext } from './InputGroup';
|
|
|
|
|
2023-05-31 03:08:41 +00:00
|
|
|
export function InputGroupAddon<TProps>({
|
|
|
|
children,
|
|
|
|
as = 'span',
|
|
|
|
...props
|
|
|
|
}: PropsWithChildren<{ as?: ComponentType<TProps> | string } & TProps>) {
|
2021-11-23 05:16:50 +00:00
|
|
|
useInputGroupContext();
|
2023-05-31 03:08:41 +00:00
|
|
|
const Component = as as 'span';
|
2021-11-23 05:16:50 +00:00
|
|
|
|
2023-05-31 03:08:41 +00:00
|
|
|
return (
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
|
|
<Component className="input-group-addon" {...props}>
|
|
|
|
{children}
|
|
|
|
</Component>
|
|
|
|
);
|
2021-11-23 05:16:50 +00:00
|
|
|
}
|