Skip to content

102 create segmented control#103

Open
scriptcoded wants to merge 6 commits intomainfrom
102-create-segmented-control
Open

102 create segmented control#103
scriptcoded wants to merge 6 commits intomainfrom
102-create-segmented-control

Conversation

@scriptcoded
Copy link
Member

It's exactly what it looks like 😄 Decided not to implement it as a form component to keep it simple.

Inspired by this component: https://www.radix-ui.com/themes/docs/components/segmented-control

Copilot AI review requested due to automatic review settings March 13, 2026 15:59
@scriptcoded scriptcoded linked an issue Mar 13, 2026 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: 53e79b3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@scouterna/ui-webc Minor
@scouterna/ui-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@scriptcoded scriptcoded requested a review from daBack March 13, 2026 15:59
@netlify
Copy link

netlify bot commented Mar 13, 2026

Deploy Preview for scouterna-ui ready!

Name Link
🔨 Latest commit 53e79b3
🔍 Latest deploy log https://app.netlify.com/projects/scouterna-ui/deploys/69b53906a39d9800085df427
😎 Deploy Preview https://deploy-preview-103--scouterna-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new scout-segmented-control Stencil component to the design system, along with Storybook docs/examples, and introduces a global “no-transition” helper to prevent initial indicator animations.

Changes:

  • Introduces scout-segmented-control (Stencil TSX + CSS) and its generated README.
  • Adds Storybook stories and MDX documentation for the new component.
  • Adds a global .no-transition host utility and a small strictness tweak in scout-tabs.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/ui-webc/src/global/global.css Adds a :host(.no-transition) rule to disable transitions (used to avoid initial indicator animations).
packages/ui-webc/src/components/tabs/tabs.tsx Adjusts decorators/definite assignment for stricter TS initialization.
packages/ui-webc/src/components/segmented-control/segmented-control.tsx New segmented control component logic (selection + indicator sizing).
packages/ui-webc/src/components/segmented-control/segmented-control.css New segmented control styling (layout, indicator, selected state).
packages/ui-webc/src/components/segmented-control/readme.md Generated docs for the new component.
packages/storybook/src/stories/segmented-control.stories.tsx Storybook interaction story for segmented control (controlled via args).
packages/storybook/src/stories/segmented-control.mdx Storybook docs page and usage example for controlled state.
.vscode/settings.json Workspace editor settings update (Biome formatter + disable ESLint fix-all on save).

Comment on lines +65 to +74
render() {
const sizeClass = this.size === "small" ? "small" : "";
const noTransitionClass = this.enableAnimations ? "" : "no-transition";

return (
<Host class={`${sizeClass} ${noTransitionClass}`}>
<slot />
{this.getIndicator()}
</Host>
);
Comment on lines +28 to +29
// <div style={{ display: "flex", width: "20rem", height: "3.5rem" }}>
// </div>
Comment on lines +77 to +86
componentDidLoad() {
this.updateChildrenAttributes();
this.calculateIndicatorSizes();

// This is a hack and it won't work on slow devices, but in most cases it
// prevents the indicator from animating prematurely.
setTimeout(() => {
this.enableAnimations = true;
}, 50);
}
Comment on lines +136 to +137

console.log("Calculated widths:", this.widths);
scriptcoded and others added 3 commits March 14, 2026 11:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@daBack
Copy link
Contributor

daBack commented Mar 15, 2026

Looks good, works good :D

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.

Create: Segmented control

3 participants