✨(react) add textItems to Field
This allow to add bullet points lists below inputs, the best example is when we want to list multiple errors from form validation. Fixes #147
This commit is contained in:
@@ -12,14 +12,14 @@ export type RadioProps = InputHTMLAttributes<HTMLInputElement> &
|
||||
};
|
||||
|
||||
export const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
||||
({ label, text, state, ...props }: RadioProps, ref) => {
|
||||
({ label, text, textItems, state, ...props }: RadioProps, ref) => {
|
||||
return (
|
||||
<label
|
||||
className={classNames("c__checkbox", "c__radio", {
|
||||
"c__checkbox--disabled": props.disabled,
|
||||
})}
|
||||
>
|
||||
<Field text={text} compact={true} state={state}>
|
||||
<Field text={text} compact={true} state={state} textItems={textItems}>
|
||||
<div className="c__checkbox__container">
|
||||
<input type="radio" {...props} ref={ref} />
|
||||
{label && <div className="c__checkbox__label">{label}</div>}
|
||||
@@ -34,6 +34,7 @@ export const RadioGroup = ({
|
||||
children,
|
||||
state,
|
||||
text,
|
||||
textItems,
|
||||
rightText,
|
||||
style,
|
||||
}: PropsWithChildren & FieldProps & { style?: React.CSSProperties }) => {
|
||||
@@ -42,6 +43,7 @@ export const RadioGroup = ({
|
||||
className="c__radio__group c__checkbox__group"
|
||||
state={state}
|
||||
text={text}
|
||||
textItems={textItems}
|
||||
rightText={rightText}
|
||||
compact={true}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user