diff --git a/.changeset/mean-monkeys-create.md b/.changeset/mean-monkeys-create.md new file mode 100644 index 0000000000..270d779753 --- /dev/null +++ b/.changeset/mean-monkeys-create.md @@ -0,0 +1,5 @@ +--- +'@backstage/ui': minor +--- + +Added diff --git a/packages/ui/src/components/Checkbox/Checkbox.module.css b/packages/ui/src/components/Checkbox/Checkbox.module.css index 54705d95e9..09fc386ff1 100644 --- a/packages/ui/src/components/Checkbox/Checkbox.module.css +++ b/packages/ui/src/components/Checkbox/Checkbox.module.css @@ -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; diff --git a/packages/ui/src/components/Checkbox/Checkbox.stories.tsx b/packages/ui/src/components/Checkbox/Checkbox.stories.tsx index 94811d5cb6..1ef1e873f4 100644 --- a/packages/ui/src/components/Checkbox/Checkbox.stories.tsx +++ b/packages/ui/src/components/Checkbox/Checkbox.stories.tsx @@ -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({ Indeterminate & Disabled + Invalid + + Invalid & Checked + + + Invalid & Indeterminate + ), });