-
Notifications
You must be signed in to change notification settings - Fork 278
feat(ui5-segmented-button): add api which controls items width behaviour #12415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🚀 Deployed on https://pr-12415--ui5-webcomponents-preview.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new contentMode
property for the ui5-segmented-button
component that controls how button items are sized. The feature allows developers to choose between equal-sized items (default) or content-fitting items where each button sizes to its content.
- Adds
SegmentedButtonContentMode
enum withEqualSized
andContentFit
options - Implements CSS classes and styling for both sizing modes
- Enhances tooltip behavior to show text content when no explicit tooltip is provided
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
SegmentedButtonContentMode.ts |
Defines the new enum for content mode values |
SegmentedButton.ts |
Adds contentMode property and implements the sizing logic |
SegmentedButton.css |
Adds CSS classes for different content modes |
SegmentedButtonTemplate.tsx |
Updates template to use dynamic CSS class |
SegmentedButtonItem.ts |
Adds slotTextContent getter for tooltip fallback |
SegmentedButtonItemTemplate.tsx |
Updates tooltip to fallback to text content |
SegmentedButton.html |
Adds test page examples for the new feature |
SegmentedButton.cy.tsx |
Adds Cypress tests for content mode behavior |
if (this.contentMode === SegmentedButtonContentMode.EqualSized) { | ||
this.style.setProperty(getScopedVarName("--_ui5_segmented_btn_items_count"), `${visibleItems.length}`); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing brace for the if statement. The code block should be properly closed.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion it would be a good idea to add sample, where we show the two new contentMode
properties next to each other.
Sample added in 81f7845 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add the sample into the SegmentedButton.mdx
file, in order to be available in the Playground.
…ebcomponents into segmented-button-width-poc
This PR introduces the new
contentMode
property for the ui5-segmented-button component, allowing developers to control how segmented button items are sized:The change improves flexibility for use cases where item content varies in length and equal sizing is not desirable.