Skip to content

Checkbox

<pa-checkbox> | PaCheckbox

A form control component that allows users to select one or more options from a set. Checkboxes are ideal for forms where multiple selections are permitted and users can toggle individual options on or off.

vue
<pa-checkbox>Accept terms and conditions</pa-checkbox>

Examples

Basic Usage

vue
<template>
  <pa-checkbox v-model="accepted">
    I agree to the terms and conditions
  </pa-checkbox>
</template>

<script setup>
import { ref } from 'vue'

const accepted = ref(false)
</script>

Checkbox Groups

Checkboxes may work together in pa-checkbox-groups.

Choose your notifications
vue
<template>
  <pa-checkbox-group label="Choose your notifications">
    <pa-checkbox v-model="notifications.email">
      Email notifications
    </pa-checkbox>
    <pa-checkbox v-model="notifications.sms">
      SMS notifications
    </pa-checkbox>
    <pa-checkbox v-model="notifications.push">
      Push notifications
    </pa-checkbox>
    <pa-checkbox disabled>
      Newsletter (coming soon)
    </pa-checkbox>
  </pa-checkbox-group>
</template>

Sizes

Use the size prop to change the checkbox size.

vue
<template>
  <div>
    <pa-checkbox v-model="defaultSize">Default size checkbox</pa-checkbox>
    <pa-checkbox v-model="largeSize" size="lg">Large size checkbox</pa-checkbox>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const defaultSize = ref(false)
const largeSize = ref(false)
</script>

Disabled State

Checkboxes can be disabled to prevent user interaction.

vue
<template>
  <div>
    <pa-checkbox disabled v-model="disabledUnchecked">
      Disabled unchecked
    </pa-checkbox>
    <pa-checkbox disabled v-model="disabledChecked">
      Disabled checked
    </pa-checkbox>
  </div>
</template>

Indeterminate State

Checkboxes can show an indeterminate state, useful for "select all" functionality.

vue
<template>
  <pa-checkbox :indeterminate="true">Select all options</pa-checkbox>
</template>

Importing

typescript
import { PaCheckbox } from '@payadvantage/ui_components'

Properties

NameDescriptionReflectsTypeDefault
modelValueThe checkbox's checked state (used with v-model).nobooleanfalse
valueThe value to emit when checked (useful in groups).nostring | nullnull
sizeThe checkbox's size.no'lg' | nullnull
indeterminateShows the checkbox in an indeterminate state.nobooleanfalse
disabledDisables the checkbox.nobooleanfalse
sfSelectorCustom selector for testing frameworks.nostring''

Events

NameDescriptionEvent Detail
update:modelValueEmitted when the checkbox state changes (for v-model).New checked state
update:indeterminateEmitted when the indeterminate state changes.New indeterminate state

Slots

NameDescription
(default)The checkbox's label content.

Dependencies

  • Bootstrap CSS: Uses Bootstrap's form check styling system for consistent appearance
  • Vue 3: Requires Vue 3 for v-model and reactive features
  • No external icon dependencies - uses browser default checkbox styling

Design Notes

The checkbox component provides:

  • Standard form control: Bootstrap-styled checkbox with consistent spacing
  • Multiple sizes: Default and large size variants for different contexts
  • Indeterminate state: Tri-state functionality for hierarchical selections
  • Form integration: Seamless v-model and validation support

This component is ideal for:

  • User preference settings and configuration options
  • Multi-selection lists and data filtering
  • Terms and agreements acceptance
  • Feature toggles and hierarchical selection patterns

Accessibility Notes

  • Uses semantic HTML form elements for proper screen reader support
  • Maintains focus states for keyboard navigation
  • Supports ARIA attributes for enhanced accessibility
  • Indeterminate state is properly communicated to assistive technologies
  • Label association ensures clickable labels for better usability