Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Introduces base state hooks for Switch following the pattern established in #35697 (Persona) and #35709 (MessageBar).

Changes

  • Types: Added SwitchBaseProps and SwitchBaseState that exclude design prop (size)
  • Hook: Added useSwitchBase_unstable containing core behavior (refs, slots, a11y, labelPosition)
  • Exports: New types and hook exported at component/library level; commented in main index.ts for experimental branch

Usage

// Custom Switch variant without size prop
const state = useSwitchBase_unstable(baseProps, ref);

// Full hook composes base + size prop
const state = useSwitch_unstable(props, ref);
// Internally calls useSwitchBase_unstable

API Surface

Export Type
useSwitchBase_unstable Hook
SwitchBaseProps Type
SwitchBaseState Type

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 3, 2026 20:27
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Copilot AI changed the title [WIP] Introduce base hooks for react-switch components feat(react-switch): add base state hooks for Switch component Feb 3, 2026
Copilot AI requested a review from dmytrokirpa February 3, 2026 20:29
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.291 MB
322.866 kB
1.291 MB
322.908 kB
38 B
42 B
react-switch
Switch
34.502 kB
10.827 kB
34.536 kB
10.832 kB
34 B
5 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.308 kB
19.905 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.217 kB
68.47 kB
react-components
react-components: FluentProvider & webLightTheme
43.523 kB
13.978 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.15 kB
35.693 kB
🤖 This report was generated against 8f7d1cc6974c5bbe6f2539ae8590ccd02cd00441

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Pull request demo site: URL

@dmytrokirpa dmytrokirpa marked this pull request as ready for review February 4, 2026 12:06
@dmytrokirpa dmytrokirpa requested a review from a team as a code owner February 4, 2026 12:06
@dmytrokirpa dmytrokirpa requested a review from a team February 4, 2026 13:11
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Copilot AI changed the title feat(react-switch): add base state hooks for Switch component refactor(react-switch): add base state hooks for Switch component Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants