UNPKG

@patreon/studio

Version:

Patreon Studio Design System

18 lines 1.16 kB
'use client'; import cx from 'classnames'; import React from 'react'; import { BodyText } from '~/components/BodyText'; import { RadioInput } from '../RadioInput/RadioInput'; import styles from './RadioButton.module.css'; const getAlignLabelClass = (alignLabel) => { return alignLabel === 'center' ? styles.alignLabelCenter : undefined; }; export function RadioButton({ id, alignLabel = 'flex-start', checked = false, 'data-tag': dataTag, children, disabled, name, onChange, value, alignButton = 'left', 'button-data-tag': buttonDataTag, ...props }) { return (<label className={cx(styles.label, getAlignLabelClass(alignLabel), alignButton === 'right' && styles.alignButtonRight, checked && styles.checked, disabled && styles.disabled)} data-tag={dataTag} htmlFor={id}> <RadioInput id={id} name={name} value={value} type="radio" checked={checked} aria-checked={checked} onChange={onChange} disabled={disabled} readOnly={checked || disabled} data-tag={buttonDataTag} {...props}/> {children && (<div className={styles.content}> <BodyText>{children}</BodyText> </div>)} </label>); } //# sourceMappingURL=index.jsx.map