🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@isoftdata/svelte-checkbox

Package Overview
Dependencies
Maintainers
11
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/svelte-checkbox

Checkbox and radio button components for Svelte 5

npmnpm
Version
2.3.0
Version published
Weekly downloads
61
-33.7%
Maintainers
11
Weekly downloads
 
Created
Source

Svelte Checkbox

Checkbox and radio button components for Svelte 5

If you want to create a group of radio buttons with arbitrary options, see here for RadioButtonGroup docs.

Install

pnpm i @isoftdata/svelte-checkbox

Breaking changes

2.0.0

  • Require Svelte 5
  • Slots -> Snippets
  • Events -> Callbacks

Props

NameTypeDescriptionDefault Value
btnGroupClassstringAny additional classes to apply to the radio buttons' div.btn-group""
checkedbooleanThe checked state of the checkbox.false
disabledbooleanWhether to disable the checkboxfalse
falseLabelstringThe label for the "false" button when type="radio"'No'
falseIconstringThe icon shown on the false buttonundefined
idstringThe id of the input(defaults to a uuid generated at runtime)
indeterminatebooleanThe indeterminate property on the input checkbox elementfalse
inlinebooleanWhether the label and input's parent div should have the Bootstrap form-check-inline class applied.
labelstringThe label to be show to the user for the checkbox''
labelClassstringAny classes to add to the label''
namestringPassed to the input when type="checkbox"
radioButtonColor"primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark"The buttons' color when type="radio"
requiredbooleanWhether the checkbox is required. For checkbox/switch types, the checkbox must be checked. For radio, either radio button must be checked (which is always true).false
showLabelbooleanWhether to show the labeltrue
titlestringtitle attribute for the input element. Browsers treat this like a tooltip''
trueLabelstringThe label for the "true" button when type="radio"'Yes'
trueIconstringThe icon shown on the true buttonundefined
type"checkbox" | "radio" | "switch"How to display the checkbox."checkbox"

Callbacks

  • change - Fired when the checkbox is checked or unchecked

In radio mode, use event.target.value instead of event.target.checked, as checked will always be true for the clicked radio button.

Example

<script lang="ts">
	import Checkbox from '@isoftdata/svelte-checkbox'

	let isTheCheckboxChecked = false
</script>

<Checkbox
	label="Checkbox!"
	bind:checked={isTheCheckboxChecked}
/>

FAQs

Package last updated on 05 May 2025

Did you know?

Socket

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.

Install

Related posts