Native checkbox with an optional label and description, custom styled without JavaScript.
You agree to our terms of service.
You agree to our terms of service.
You agree to our terms of service.
You agree to our terms of service.
At most one email per month.
At most one email per month.
<x-markas.checkbox label="Accept terms and conditions" /><x-markas.checkbox label="Accept terms and conditions" disabled /><x-markas.checkbox label="Accept terms and conditions" description="You agree to our terms of service." /><x-markas.checkbox label="Accept terms and conditions" description="You agree to our terms of service." disabled />import { Checkbox } from "@/components/markas/Checkbox";
<Checkbox label="Accept terms and conditions" />import { Checkbox } from "@/components/markas/Checkbox";
<Checkbox label="Accept terms and conditions" disabled />import { Checkbox } from "@/components/markas/Checkbox";
<Checkbox label="Accept terms and conditions" description="You agree to our terms of service." />import { Checkbox } from "@/components/markas/Checkbox";
<Checkbox label="Accept terms and conditions" description="You agree to our terms of service." disabled />import Checkbox from "@/components/markas/Checkbox.vue";
<Checkbox label="Accept terms and conditions" />import Checkbox from "@/components/markas/Checkbox.vue";
<Checkbox label="Accept terms and conditions" disabled />import Checkbox from "@/components/markas/Checkbox.vue";
<Checkbox label="Accept terms and conditions" description="You agree to our terms of service." />import Checkbox from "@/components/markas/Checkbox.vue";
<Checkbox label="Accept terms and conditions" description="You agree to our terms of service." disabled />Examples
List with descriptions
<fieldset class="min-w-0">
<legend class="mb-3 text-sm font-medium text-ink">Email me when</legend>
<div class="grid gap-4">
<x-markas.checkbox name="comments" label="Someone comments" description="Replies to your posts and threads you follow." checked />
<x-markas.checkbox name="mentions" label="Someone mentions me" description="Any message that includes your username." checked />
<x-markas.checkbox name="invites" label="I am invited to a project" description="Includes invitations from outside your workspace." />
</div>
</fieldset>Cards
States
Editor defaults are managed by your organization.
Editor defaults are managed by your organization.
Editor defaults are managed by your organization.
Editor defaults are managed by your organization.
Editor defaults are managed by your organization.
<div class="grid gap-4">
<x-markas.checkbox name="line_numbers" label="Show line numbers" />
<x-markas.checkbox name="wrap" label="Wrap long lines" checked />
<x-markas.checkbox name="format" label="Format on save" disabled />
<x-markas.checkbox name="autosave" label="Auto save" checked disabled />
<p class="text-sm text-muted">Editor defaults are managed by your organization.</p>
</div>Horizontal
<fieldset class="min-w-0">
<legend class="mb-3 text-sm font-medium text-ink">Notify me by</legend>
<div class="flex flex-wrap gap-x-6 gap-y-3">
<x-markas.checkbox name="channels[]" value="email" label="Email" checked />
<x-markas.checkbox name="channels[]" value="sms" label="SMS" />
<x-markas.checkbox name="channels[]" value="push" label="Push" checked />
<x-markas.checkbox name="channels[]" value="slack" label="Slack" />
</div>
</fieldset>Installation
npx markasui@latest add checkboxpnpm dlx markasui@latest add checkboxyarn dlx markasui@latest add checkboxbunx --bun markasui@latest add checkbox- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
resources/views/components/markas/checkbox.blade.php.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Checkbox.tsx.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Checkbox.vue.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/Checkbox.svelte.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Checkbox.astro.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/checkbox.component.ts.
Usage
<x-markas.checkbox name="terms" label="I agree to the terms of service" required />
<x-markas.checkbox name="updates" label="Send me product updates" description="At most one email per month." :checked="old('updates')" />import { Checkbox } from "@/components/markas/Checkbox";
<Checkbox name="terms" label="I agree to the terms of service" required />
<Checkbox
name="updates"
label="Send me product updates"
description="At most one email per month."
defaultChecked
/><script setup lang="ts">
import { ref } from "vue";
import Checkbox from "@/components/markas/Checkbox.vue";
const updates = ref(false);
</script>
<template>
<Checkbox
v-model="updates"
name="updates"
label="Send me product updates"
description="At most one email per month."
/>
</template><script lang="ts">
import Checkbox from "$lib/components/markas/Checkbox.svelte";
let updates = $state(false);
</script>
<Checkbox
bind:checked={updates}
name="updates"
label="Send me product updates"
description="At most one email per month."
/>---
import Checkbox from "@/components/markas/Checkbox.astro";
---
<Checkbox name="terms" label="I agree to the terms of service" required />
<Checkbox name="updates" label="Send me product updates" description="At most one email per month." checked />No client script: the checkbox is a native input.
import { Component, signal } from "@angular/core";
import { Checkbox } from "./markas/checkbox.component";
@Component({
selector: "app-preferences",
imports: [Checkbox],
template: `
<markas-checkbox
[(checked)]="updates"
name="updates"
label="Send me product updates"
description="At most one email per month."
/>
`,
})
export class Preferences {
readonly updates = signal(false);
}- Extra attributes (
name,value,required,class) go to the<input>element. - The checked look uses CSS
:checked(thechecked:andpeer-checked:variants), notdata-state, so it stays correct without JavaScript. - The component has no built-in text. Translate
labelanddescriptiondirectly.
Props
| Name | Type | Default | Description |
|---|---|---|---|
label | string | - | Label text next to the box, linked through for/id. |
description | string | - | Supporting text below the label, linked through aria-describedby. |
checked / defaultChecked / v-model / bind:checked | boolean | false | Checked state. Blade and Astro use the checked attribute, React checked or defaultChecked, Vue v-model, Svelte bind:checked, Angular checked or [(checked)]. |
disabled | boolean | false | Disables the checkbox and dims the label. |
id | string | auto | Input id. Generated when empty. |
checkedChange | output<boolean> | - | Angular only. Emits the new state every time the checkbox changes. |
Accessibility
- Uses a native checkbox input, so Space toggles it and screen readers announce its state.
- The label is linked through for and id, so clicking the label toggles the box too.
- The check icon is decorative (aria-hidden), the visual state follows :checked.
Related components
More form components with the same classes in every framework.
- ButtonButton with primary, secondary, ghost, and danger variants.
- ComboboxText input with a filtered suggestion list in a popover, following the WAI-ARIA Combobox pattern with list autocomplete.
- InputText field with a label, hint, and error message wired up through ARIA.
- Input OTPOne-time code input split into single-digit boxes, with auto advance, paste support, and one hidden field for form submit.
- LabelForm label with consistent styling and optional required or optional markers that screen readers announce correctly.
- Radio GroupGroup of native radios inside a fieldset and legend for picking one of several options.