diff --git a/.changeset/tired-clowns-walk.md b/.changeset/tired-clowns-walk.md
new file mode 100644
index 000000000..87453e928
--- /dev/null
+++ b/.changeset/tired-clowns-walk.md
@@ -0,0 +1,5 @@
+---
+'@vapor-ui/core': patch
+---
+
+propagate `invalid` state to indicator element
diff --git a/packages/core/src/components/checkbox/checkbox.test.tsx b/packages/core/src/components/checkbox/checkbox.test.tsx
index fbfc655ae..bdb5bb96c 100644
--- a/packages/core/src/components/checkbox/checkbox.test.tsx
+++ b/packages/core/src/components/checkbox/checkbox.test.tsx
@@ -183,6 +183,17 @@ describe('Checkbox', () => {
expect(checkbox).not.toHaveAttribute('aria-invalid');
});
+
+ it('should propagate the invalid state to the indicator', async () => {
+ const rendered = render(
+
+
+ ,
+ );
+ const indicator = rendered.getByTestId('indicator');
+
+ expect(indicator).toHaveAttribute('data-invalid');
+ });
});
describe('prop: indeterminate', () => {
@@ -217,6 +228,17 @@ describe('Checkbox', () => {
expect(checkbox).toHaveAttribute('aria-checked', 'mixed');
});
+
+ it('should propagate the indeterminate state to the indicator', async () => {
+ const rendered = render(
+
+
+ ,
+ );
+ const indicator = rendered.getByTestId('indicator');
+
+ expect(indicator).toHaveAttribute('data-indeterminate');
+ });
});
describe('prop: disabled', () => {
@@ -245,6 +267,17 @@ describe('Checkbox', () => {
expect(onCheckedChange).not.toHaveBeenCalled();
expect(checkbox).not.toBeChecked();
});
+
+ it('should propagate the disabled state to the indicator', async () => {
+ const rendered = render(
+
+
+ ,
+ );
+ const indicator = rendered.getByTestId('indicator');
+
+ expect(indicator).toHaveAttribute('data-disabled');
+ });
});
describe('prop: readOnly', () => {
@@ -292,6 +325,17 @@ describe('Checkbox', () => {
await userEvent.tab();
expect(nextButton).toHaveFocus();
});
+
+ it('should propagate the readOnly state to the indicator', async () => {
+ const rendered = render(
+
+
+ ,
+ );
+ const indicator = rendered.getByTestId('indicator');
+
+ expect(indicator).toHaveAttribute('data-readonly');
+ });
});
});
diff --git a/packages/core/src/components/checkbox/checkbox.tsx b/packages/core/src/components/checkbox/checkbox.tsx
index b1b5e6c9a..93077090a 100644
--- a/packages/core/src/components/checkbox/checkbox.tsx
+++ b/packages/core/src/components/checkbox/checkbox.tsx
@@ -58,7 +58,7 @@ export const CheckboxRoot = forwardRef((props,
},
});
- return {root};
+ return {root};
});
CheckboxRoot.displayName = 'Checkbox.Root';