Skip to content

UCheckbox/USwitch: add support for true/false custom values #5821

@nicola-spadari

Description

@nicola-spadari

Package

v4.x

Description

Just like native checkboxes, it would be useful for some cases (eg. data coming from MySQL or other DBs) when 1 is true, and 0 is false.

In Vue we can do

<input type="checkbox" v-model="myRef" :true-value="1" :false-value="0" />

But with USwitch or UCheckbox it doesn't work. This also messes up with validation schemas like Zod, which expects a number but the component toggles to boolean as soon as it's changed.

If this is wanted behavior, please suggest a workaround, but if possible please add the same :true-value="1" :false-value="0" logic to handle these cases

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions