Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@rmwc/radio
Advanced tools
Radio buttons allow the user to select one option from a set. Use radio buttons for exclusive selection if you think that the user needs to see all available options side-by-side.
function Example() {
const [value, setValue] = React.useState('cookies');
return (
<>
<Radio
value="cookies"
checked={value === 'cookies'}
onChange={(evt) => setValue(String(evt.currentTarget.value))}
>
Cookies
</Radio>
<Radio
value="pizza"
checked={value === 'pizza'}
onChange={(evt) => setValue(String(evt.currentTarget.value))}
>
Pizza
</Radio>
<Radio
value="icecream"
checked={value === 'icecream'}
onChange={(evt) => setValue(String(evt.currentTarget.value))}
>
Icecream
</Radio>
</>
);
}
You can use Radio Buttons and receive change events without having to manually set the checked
prop. Just give the Radio components the same name
. This example also shows using the label
prop instead of setting the label as a child.
<>
<Radio
label="Cookies"
value="cookies"
name="myRadioGroup"
onChange={(evt) => console.log(evt.currentTarget.value)}
/>
<Radio
label="Pizza"
value="pizza"
name="myRadioGroup"
onChange={(evt) => console.log(evt.currentTarget.value)}
/>
<Radio
label="Icecream"
value="icecream"
name="myRadioGroup"
onChange={(evt) => console.log(evt.currentTarget.value)}
/>
</>
A Radio button component.
Name | Type | Description |
---|---|---|
checked | boolean | Toggle the control on and off. |
disabled | boolean | Disables the control. |
foundationRef | Ref<MDCRadioFoundation<>> | Advanced: A reference to the MDCFoundation. |
id | string | A DOM ID for the toggle. |
inputRef | Ref<HTMLInputElement<>> | A reference to the native input. |
label | ReactNode | A label for the control. |
ripple | RipplePropT | Adds a ripple effect to the component |
rootProps | HTMLProps<any> | By default, all props except className and style spread to the input. These are additional props for the root of the checkbox. |
value | string | number | string[] | The value of the control. |
FAQs
RMWC Radio component
The npm package @rmwc/radio receives a total of 3,649 weekly downloads. As such, @rmwc/radio popularity was classified as popular.
We found that @rmwc/radio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.