Skip to content

[SettingsExpander] Add FluentSettingsExpander - #5593

Open
Marvin Klein (MarvinKlein1508) wants to merge 24 commits into
microsoft:devfrom
MarvinKlein1508:marvinklein1508-settings-accordion-card
Open

Marvin Klein (MarvinKlein1508) wants to merge 24 commits into
microsoft:devfrom
MarvinKlein1508:marvinklein1508-settings-accordion-card

Conversation

@MarvinKlein1508

Copy link
Copy Markdown
Collaborator

Pull Request

📖 Description

This PR introduces the new FluentSettingsExpander component, inspired by the expandable settings cards found in Windows 11 Settings.

The component provides a modern, consistent way to display settings and configuration options using Fluent UI design principles.

Desktop:

grafik

Mobile:

grafik

Features

  • Windows 11-inspired design: Rounded corners, subtle borders, and styling based on Fluent Design Tokens.
  • Expandable content: Supports collapsible sections through ChildContent, including two-way binding with @bind-Expanded.
  • Flexible layout: Supports icons, headers, descriptions, and custom actions such as switches, sliders, and dropdowns.
  • Navigation support: Optional Href and Target properties allow settings cards to function as navigation links.
  • Native Fluent icons: Uses FluentIcon for consistent icon rendering.
  • Disabled state: Prevents interaction and expansion when the component is disabled.
  • Nested settings: Supports grouping related settings within expandable sections.
  • Accessibility: Includes appropriate ARIA attributes and accessible labels.

Documentation and Examples

Added component documentation and several interactive examples to the demo application, demonstrating different configurations and usage scenarios.

🎫 Issues

👩‍💻 Reviewer Notes

Please focus on the following areas during review:

  • Visual consistency with Windows 11 Settings and existing Fluent UI components.
  • Expansion behavior, including controlled state through Expanded and ExpandedChanged.
  • Interaction handling for nested actions and navigation links.
  • Accessibility and keyboard interaction.
  • Correct behavior when the component is disabled.

Recommended smoke test:

  1. Open the SettingsExpander component in the demo application.
  2. Verify the appearance of the different examples.
  3. Expand and collapse settings cards.
  4. Test embedded controls such as sliders, switches, and dropdowns.
  5. Verify navigation behavior for cards with an Href.
  6. Confirm that disabled components cannot be expanded.
  7. Verify keyboard navigation and accessibility attributes.

📑 Test Plan

Unit Tests have been added. 100% coverage

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Issue discussion declaration

Discuss changes before implementing them to confirm that the problem and proposed approach fit the project. See Discuss before implementing for the process and exceptions.

  • I have discussed this change in an issue and received maintainer agreement before implementation, or a documented exception applies.

AI contribution declaration

AI assistance is allowed; fully AI-generated or autonomous pull requests without meaningful human review are not accepted. See the AI contribution policy.

  • I have read and followed the AI contribution policy.
  • I have personally reviewed and understood all changes, tested them, and take responsibility for this contribution.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Outstanding issues leave disabled expander descendants interactive, misplace switch and checkbox actions on narrow screens, and leave six demo controls without accessible names.

3 open issues
What changed in this PR

Introduces FluentSettingsExpander to the component library, providing Windows 11-style settings cards with optional actions, navigation and expandable content.

Changes:

  • Adds component markup, bindable expansion state and responsive styling.
  • Adds a core navigation icon and five documented usage examples.
  • Adds unit tests for rendering, expansion, navigation, labels and disabled behavior.
File Description
tests/​Core/​Components/​SettingsExpander/​FluentSettingsExpanderTests.razor Tests component rendering and interaction behavior.
src/​Core/​Components/​SettingsExpander/​FluentSettingsExpander.razor.css Styles cards, nested rows and responsive layouts.
src/​Core/​Components/​SettingsExpander/​FluentSettingsExpander.razor.cs Defines parameters and expansion handlers.
src/​Core/​Components/​SettingsExpander/​FluentSettingsExpander.razor Renders headers, actions, navigation and panels.
src/​Core/​Components/​Icons/​CoreIcons.cs Adds the core Open icon.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​FluentSettingsExpander.md Documents usage and embeds examples.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​Examples/​SettingsExpanderVerbosity.razor Demonstrates dropdowns, sliders and nested settings.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​Examples/​SettingsExpanderManageData.razor Demonstrates buttons, switches and navigation.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​Examples/​SettingsExpanderExpandable.razor Demonstrates bound expansion and nested rows.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​Examples/​SettingsExpanderDisabled.razor Demonstrates a disabled setting.
examples/​Demo/​FluentUI.Demo.Client/​Documentation/​Components/​SettingsExpander/​Examples/​SettingsExpanderDefault.razor Demonstrates a basic settings card.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants