![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@accessible/checkbox
Advanced tools
npm i @accessible/checkbox
An accessible checkbox component for React. This library allows you to create your own a checkbox with your own styles while maintaining the ability to focus and update a checkbox input with the keyboard.
Check out the example on CodeSandbox
import {Checkbox, Checkmark} from '@accessible/checkbox'
const MyCheckbox = () => (
<label className='my-checkbox'>
<Checkbox name='my-field-name'>
<span className='my-checkbox'>
<Checkmark checkedClass='checked' uncheckedClass='unchecked'>
<span className='checkmark' />
</Checkmark>
</span>
</Checkbox>
Check me!
</label>
)
Creates a visually hidden checkbox input that is focusable and accessible via keyboard navigation.
All props passed to this component are applied to the <input>
. This also creates a context
provider enabling the other components in this library to access the checkbox's state
deep in the tree.
Prop | Type | Default | Required? | Description |
---|---|---|---|---|
checked | boolean | undefined | No | Makes the checkbox a controlled component which can no longer be updated with check , uncheck , and toggle controls. |
defaultChecked | boolean | undefined | No | Set this to true to make the checkbox checked by default. |
onChange | (checked: boolean) => any | undefined | No | Called each time the checked state changes. |
children | React.ReactNode | undefined | No | Your custom styled checkbox. |
A convenient component for conditionally adding class names and styles when the component is checked/unchecked.
Prop | Type | Default | Required? | Description |
---|---|---|---|---|
uncheckedClass | string | undefined | No | This class name will be applied to the child element when the checkbox is unchecked . |
checkedClass | string | undefined | No | This class name will be applied to the child element when the checkbox is checked . |
uncheckedStyle | React.CSSProperties | undefined | No | These styles will be applied to the child element when the checkbox is unchecked . |
checkedStyle | React.CSSProperties | undefined | No | These styles name will be applied to the child element when the checkbox is checked . |
children | React.ReactNode | undefined | Yes | The child you wish to render when the checkbox is checked. |
The child of this component will only render when the <Checkbox>
is in
a checked
state. It must be a child of a <Checkbox>
.
Prop | Type | Default | Required? | Description |
---|---|---|---|---|
children | React.ReactNode | undefined | Yes | The child you wish to render when the checkbox is checked. |
The child of this component will only render when the <Checkbox>
is in
an unchecked
state. It must be a child of a <Checkbox>
.
Prop | Type | Default | Required? | Description |
---|---|---|---|---|
children | React.ReactNode | undefined | Yes | The child you wish to render when the checkbox is unchecked. |
This component clones its child and adds an onClick
handler to toggle the <Checkbox>
between
checked
and unchecked
states. It must be a child of a <Checkbox>
.
Prop | Type | Default | Required? | Description |
---|---|---|---|---|
children | React.ReactNode | undefined | Yes | The child you wish to render when the checkbox is unchecked. |
A React hook that returns the CheckboxContextValue
for the nearest <Checkbox>
parent.
interface CheckboxContextValue {
// Does the checkbox have a `checked` property?
checked: boolean
// Is the checkbox currently focused?
focused: boolean
// Is the checkbox currently disabled?
disabled: boolean
// Checks the checkbox
check: () => void
// Unchecks the checkbox
uncheck: () => void
// Toggles the checkbox `checked` property
toggle: () => void
}
MIT
FAQs
🅰 An accessible and versatile checkbox component for React
The npm package @accessible/checkbox receives a total of 159 weekly downloads. As such, @accessible/checkbox popularity was classified as not popular.
We found that @accessible/checkbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.