
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@rmwc/switch
Advanced tools
> On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.
On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.
Switches are identical in function to the Checkbox component, they just present a different UI / UX paradigm.
Uncontrolled
<Switch defaultChecked label\="Pizza" />
Controlled
function Example() {
const \[checked, setChecked\] \= React.useState(false);
return (
<Switch
checked\={checked}
onClick\={(evt) \=> setChecked((c) \=> !c)}
label\="Cookies"
/>
);
}
Label as Child
<Switch\>Icecream</Switch\>
Disabled
<\>
<Switch disabled label\="Disabled" />
<Switch disabled defaultChecked label\="Disabled" />
</\>
FAQs
On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.
The npm package @rmwc/switch receives a total of 3,203 weekly downloads. As such, @rmwc/switch popularity was classified as popular.
We found that @rmwc/switch 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.