fix(ui): add invalid state styling to Checkbox component

Signed-off-by: Deepthi Ajith <deepthi.ajith@infosys.com>
This commit is contained in:
Deepthi Ajith
2026-04-08 10:26:00 +00:00
committed by Johan Persson
parent 3b8c0557c6
commit 23ee7899b0
3 changed files with 31 additions and 0 deletions
@@ -68,6 +68,19 @@
color: var(--bui-fg-primary);
}
.bui-Checkbox[data-invalid] & {
box-shadow: inset 0 0 0 1px var(--bui-border-danger);
}
.bui-Checkbox[data-invalid][data-selected] & {
background-color: var(--bui-border-danger);
box-shadow: none;
}
.bui-Checkbox[data-invalid][data-indeterminate] & {
box-shadow: inset 0 0 0 1px var(--bui-border-danger);
}
@media (prefers-reduced-motion: reduce) {
& {
transition: none;
@@ -62,6 +62,12 @@ export const WithLongText = Default.extend({
],
});
export const Invalid = Default.extend({
args: {
isInvalid: true,
},
});
export const AllVariants = meta.story({
...Default.input,
render: () => (
@@ -76,6 +82,13 @@ export const AllVariants = meta.story({
<Checkbox isIndeterminate isDisabled>
Indeterminate & Disabled
</Checkbox>
<Checkbox isInvalid>Invalid</Checkbox>
<Checkbox isInvalid isSelected>
Invalid & Checked
</Checkbox>
<Checkbox isInvalid isIndeterminate>
Invalid & Indeterminate
</Checkbox>
</Flex>
),
});