fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Feature]: SearchBox - Support fixed/constrained width mode

Open spenoff opened this issue 7 months ago • 1 comments

Area

React Components (@fluentui/react-components)

Describe the feature that you would like added

The v9 SearchBox does not support a fixed-width mode. In v8, the SearchBox had a default fixed width that could be controlled. In v9, the component always stretches to fill its container, requiring external CSS wrappers to constrain width. We currently have a workaround in place, but we think it is reasonable to expect Fluent UI to support features like this.

Use case: Multiple AMC pages (Profile display language, Privacy, Websearch) relied on the v8 SearchBox's fixed-width behavior. After migration to v9, all required additional wrapper elements with explicit width styles.

Proposed solution: Add a style or width prop, or expose a root slot that respects fixed-width configuration without requiring an outer wrapper div.

Additional context

  • Previously filed as #33888 (by same author, different account) but was auto-closed by the inactivity bot. The issue was not resolved -- Miroslav Stastny offered a maxWidth: 'unset' style override workaround, but this is still just a workaround and not actual support in the component.
  • Pages impacted: Profile display language, Privacy, Websearch
  • This was supported in v8

Have you discussed this feature with our team

@miroslavstastny

Validations

  • [x] Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Priority

Medium

spenoff avatar Apr 12 '26 05:04 spenoff

v9's SearchBox already caps at maxWidth: 468px and uses inline-flex so it fills its container up to that cap. For a fixed narrower width, wrap in a sized container or override maxWidth via className. Closing as By Design; superseding #33888.

tudorpopams avatar Apr 20 '26 15:04 tudorpopams