Skip to main content

NeoPopCheckbox

A NeoPop-styled checkbox with optional label, configurable checked/unchecked colors, and haptic feedback.

Usage

// dark mode example
import { NeoPopCheckbox } from 'neopop-rn';
import { useState } from 'react';

function Example() {
const [checked, setChecked] = useState(false);

return (
<NeoPopCheckbox
isChecked={checked}
onValueChange={setChecked}
label="I agree to the terms"
labelPosition="right"
mode="dark"
colorMode="dark"
enableHaptics
/>
);
}
// light mode example
import { NeoPopCheckbox } from 'neopop-rn';
import { useState } from 'react';

function Example() {
const [checked, setChecked] = useState(false);

return (
<NeoPopCheckbox
isChecked={checked}
onValueChange={setChecked}
label="Subscribe to newsletter"
labelPosition="right"
mode="light"
colorMode="light"
colorConfig={{
checkedBorderColor: '#06C270',
checkedFillColor: '#06C270',
uncheckedBorderColor: '#cccccc',
uncheckedFillColor: '#ffffff',
checkmarkColor: '#ffffff',
}}
/>
);
}

Props

PropTypeDefaultDescription
isCheckedbooleanRequired. Current checked state.
onValueChange(value: boolean) => voidRequired. Called with the new boolean value when toggled.
mode'dark' | 'light' | 'custom'Selects a built-in color preset; 'custom' defers entirely to colorConfig.
colorConfigNeoPopCheckboxColorConfigPer-token color overrides (see colorConfig table).
labelstringOptional text label displayed beside the checkbox.
labelPosition'left' | 'right'Side on which the label is rendered relative to the box.
sizenumberWidth and height of the checkbox in logical pixels.
disabledbooleanDisables interaction.
enableHapticsbooleanFires a haptic on toggle.
colorMode'dark' | 'light'Theme mode used for global defaults.
styleStyleProp<ViewStyle>Additional style applied to the outer row container.
labelStyleStyleProp<TextStyle>Additional style applied to the label text.

colorConfig

KeyDescription
checkedBorderColorBorder color when the checkbox is checked.
checkedFillColorBackground fill color when checked.
uncheckedBorderColorBorder color when unchecked.
uncheckedFillColorBackground fill color when unchecked.
checkmarkColorColor of the checkmark tick drawn inside the box.

Notes

  • In 'custom' mode all colors must be supplied via colorConfig; the component does not apply built-in theme defaults.
  • size controls both width and height of the box, keeping it square.
  • When disabled is true, the component ignores press events but does not automatically reduce opacity; apply visual dimming via style or colorConfig as needed.