diff --git a/change/@fluentui-react-checkbox-efe8019d-5ed0-4eec-ae6d-674f97612c48.json b/change/@fluentui-react-checkbox-efe8019d-5ed0-4eec-ae6d-674f97612c48.json new file mode 100644 index 00000000000000..1aed21fbc91525 --- /dev/null +++ b/change/@fluentui-react-checkbox-efe8019d-5ed0-4eec-ae6d-674f97612c48.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: add motion to Checkbox", + "packageName": "@fluentui/react-checkbox", + "email": "marcosvmmoura@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-checkbox/library/etc/react-checkbox.api.md b/packages/react-components/react-checkbox/library/etc/react-checkbox.api.md index 737435fddd1d9d..1f8159df3300f5 100644 --- a/packages/react-components/react-checkbox/library/etc/react-checkbox.api.md +++ b/packages/react-components/react-checkbox/library/etc/react-checkbox.api.md @@ -42,6 +42,7 @@ export type CheckboxSlots = { label?: Slot; input: NonNullable>; indicator: Slot<'div', 'span'>; + checkmarkIcon: Slot<'svg', 'div' | 'span' | 'img'>; }; // @public diff --git a/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.test.tsx b/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.test.tsx index 537c4d61bbad4d..3316c954c6c2d8 100644 --- a/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.test.tsx +++ b/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.test.tsx @@ -54,6 +54,13 @@ describe('Checkbox', () => { expect(renderedComponent.container).toMatchSnapshot(); }); + it('renders a custom checkmark icon', () => { + const renderedComponent = render( + } label="Custom checkmark icon" />, + ); + expect(renderedComponent.container).toMatchSnapshot(); + }); + it('respects id prop', () => { const renderedComponent = render(); expect(renderedComponent.getByRole('checkbox').id).toEqual('checkbox'); diff --git a/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.types.ts b/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.types.ts index 96095670447b15..d645f994742daf 100644 --- a/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.types.ts +++ b/packages/react-components/react-checkbox/library/src/components/Checkbox/Checkbox.types.ts @@ -31,6 +31,11 @@ export type CheckboxSlots = { // but changing the signature would be a breaking change // TODO: change the default value to 'span' in the next major indicator: Slot<'div', 'span'>; + + /** + * The checkmark icon displayed inside the indicator when checked. + */ + checkmarkIcon: Slot<'svg', 'span' | 'img'>; }; /** diff --git a/packages/react-components/react-checkbox/library/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap b/packages/react-components/react-checkbox/library/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap index c5728b884831ac..38c36eeabfe3d2 100644 --- a/packages/react-components/react-checkbox/library/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +++ b/packages/react-components/react-checkbox/library/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap @@ -1,5 +1,44 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Checkbox renders a custom checkmark icon 1`] = ` +
+ + + + + +
+`; + exports[`Checkbox renders a custom indicator 1`] = `