Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

va-sort: add new component#1963

Merged
jamigibbs merged 24 commits intomainfrom
4637-sort-component
Feb 10, 2026
Merged

va-sort: add new component#1963
jamigibbs merged 24 commits intomainfrom
4637-sort-component

Conversation

@jamigibbs
Copy link
Copy Markdown
Contributor

@jamigibbs jamigibbs commented Jan 29, 2026

Chromatic

https://4637-sort-component--65a6e2ed2314f7b8f98609d8.chromatic.com

Description

This PR will add the new va-sort web component.

Related tickets and links

Closes department-of-veterans-affairs/vets-design-system-documentation#4637

Screenshots

https://design.va.gov/foundation/breakpoints

Tablet (640px) and above

Screenshot 2026-02-06 at 9 08 27 AM

Below Tablet

Screenshot 2026-02-06 at 9 08 43 AM

Below tablet, width is always 100%

Screenshot 2026-02-06 at 9 45 21 AM

Testing and review

Approvals

See the QA Checklists section below for suggested approvals. Use your best judgment if additional reviews are needed. When in doubt, request a review.

Approval groups

Add approval groups to the PR as needed:

QA checklists

Use the QA checklists below as guides, not rules. Not all checklists will apply to every PR but there could be some overlap.

In all scenarios, changes should be fully tested by the author and verified by the reviewer(s); functionality, responsiveness, etc.

✨ New Component Added
  • The PR has the minor label
  • The component matches the Figma designs.
  • All properties, custom events, and utility functions have e2e and/or unit tests
  • A new Storybook page has been added for the component
  • Tested in all VA breakpoints.
  • Chromatic UI Tests have run and snapshot changes have been accepted by the design reviewer
  • Tested in vets-website using Verdaccio
  • Engineering has approved the PR
  • Design has approved the PR
  • Accessibility has approved the PR
🌱 New Component Variation Added
  • The PR has the minor label
  • The variation matches its Figma design.
  • Any new properties, custom events, or utility functions have e2e and/or unit tests
  • A new story has been added to the component's existing Storybook page
  • Any Chromatic UI snapshot changes have been accepted by a design reviewer
  • Tested in vets-website using Verdaccio
  • Engineering has approved the PR
  • Design has approved the PR
🐞 Component Fix
  • The PR has the patch label
  • Any new properties, custom events, or utility functions have e2e and/or unit tests
  • Any markup changes are evaluated for impact on vets-website.
    • Will any vets-website tests fail from the change?
  • Any Chromatic UI snapshot changes have been reviewed and approved by a designer if necessary
  • Engineering has approved the PR
♿️ Component Fix - Accessibility
  • The PR has the patch label
  • Any new properties, custom events, or utility functions have e2e and/or unit tests
  • Any Chromatic UI snapshot changes have been reviewed and approved by a designer if necessary
  • Engineering has approved the PR
  • Accessibility has approved the PR
🚨 Component Fix - Breaking API Change
  • The PR has the major label
  • vets-website and content-build have been evaluated to determine the impact of the breaking change
  • Any new properties, custom events, or utility functions have e2e and/or unit tests
  • Any Chromatic UI snapshot changes have been reviewed and approved by a designer if necessary
  • Tested in vets-website using Verdaccio
  • Engineering has approved the PR
🔧 Component Update - Non-Breaking API Change
  • The PR has the minor label
  • Any new properties, custom events, or utility functions have e2e and/or unit tests
  • Any Chromatic UI snapshot changes have been reviewed and approved by a designer if necessary
  • Engineering has approved the PR
📖 Storybook Update
  • The PR has the ignore-for-release label
  • Any Chromatic UI snapshot changes have been reviewed and approved by a designer if necessary
  • Engineering has approved the PR
🎨 CSS-Library Update
  • The PR has the css-library label
  • vets-website and content-build have been checked to determine the impact of any breaking changes
  • Engineering has approved the PR

@jamigibbs jamigibbs added the minor For a minor Semantic Version change label Jan 29, 2026
* Displays the select at a specific width. Accepts md or medium (20ex), lg (30ex), xl (40ex).
*/
// eslint-disable-next-line i18next/no-literal-string
@Prop() width: string = 'lg';
Copy link
Copy Markdown
Contributor Author

@jamigibbs jamigibbs Feb 2, 2026

Choose a reason for hiding this comment

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

note: The enforcement of these specific options (md, lg, & xl) is done by using a dedicated class in the uswds-input-width Sass file.

/**
* Whether or not to fire the analytics events
*/
@Prop() enableAnalytics?: boolean = false;
Copy link
Copy Markdown
Contributor Author

@jamigibbs jamigibbs Feb 2, 2026

Choose a reason for hiding this comment

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

question The va-select component makes analytics opt-in using this property enableAnalytics. This is standard for all form component to avoid unintentionally leaking PII/PHI.

Is the va-sort component considered a forms component though? If not, then we could make analytics opt-out by changing this to disableAnalytics.

@@ -1,25 +1,37 @@
$system-input-widths: (
Copy link
Copy Markdown
Contributor Author

@jamigibbs jamigibbs Feb 2, 2026

Choose a reason for hiding this comment

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

note: I wrote this as a comment in the file itself but adding it here too for visibility; this Sass variable declaration $system-input-widths is intended to be temporary until we update the USWDS package version.

When USWDS is updated to v3.11.0+, we should instead use:

@use 'uswds-core' as *;

...and the $system-input-widths mapping will be available in the uswds-core package directly. As of this writing, the web-components package is using v3.9.0

Image

related issue:

selectLabel: this.value,
},
};
this.componentLibraryAnalytics.emit(detail);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: I will be reaching out to the analytics team to let them know we are adding a new component with analytics. A PR to vets-website will follow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs jamigibbs requested review from a team February 2, 2026 16:33
@jamigibbs jamigibbs marked this pull request as ready for review February 2, 2026 16:34
@jamigibbs jamigibbs requested a review from a team as a code owner February 2, 2026 16:34
@@ -0,0 +1,119 @@
import { Component, Host, h, Prop, Event, EventEmitter } from '@stencil/core';

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.

The jsDoc section is missing with the @componentName, @maturityCategory, and @maturityLevel

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

@derekwang99
Copy link
Copy Markdown
Contributor

Hi @jamigibbs thanks for taking on this component! Can the spacing between Sort by and Relevance in the in-line/desktop view be modified to be 8px apart? I think it's currently 16?

@derekwang99 derekwang99 self-requested a review February 4, 2026 23:14
@derekwang99
Copy link
Copy Markdown
Contributor

Hi @jamigibbs! Some additional suggestions to implement as discussed from Standup today:

  • On mobile devices, Sort should be full width (so for Small and XSmall screens full-width behavior should override the default Sort size)
  • The sort options should be changed to reflect guidance
    • Sort by
      • Relevance
      • Medication name (A to Z)
      • Medication name (Z to A)
      • Fill date (newest to oldest)
      • Fill date (oldest to newest)

Also wanted to add 2 other suggestions:

  • From Dan: change the name of Custom Value story to Custom Default Value
  • From me: change the name of Custom Width story to Widths (to match Select) + can the spacing between h4 and component and spacing between each width variation in Small/XSmall match the spacing in Medium+ ?
image image

@jamigibbs
Copy link
Copy Markdown
Contributor Author

@derekwang99 Thanks for that feedback! I've made updates to address them and you're welcome to review again. 🙏🏻

Copy link
Copy Markdown
Contributor

@derekwang99 derekwang99 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Jami!

@jamigibbs jamigibbs requested a review from a team February 6, 2026 18:33
// flex-basis instead of max-width in order to adjust the width
@media (min-width: tokens.$tablet) {
max-width: none;
flex-basis: map-get($system-input-widths, $size);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: The sort component has a dedicated class for applying width for two reasons:

  1. It should only support specific widths
  2. The container has been changed to flex to allow for the label to be positioned horizontally to the select field so it needs to use flex-basis to set the initial size of the container. max-width does not work with flex.

:host .va-select__sort-container {
@each $size in ('md', 'medium', 'lg', 'xl') {
&--#{$size} {
max-width: 100%;
Copy link
Copy Markdown
Contributor Author

@jamigibbs jamigibbs Feb 6, 2026

Choose a reason for hiding this comment

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

note: Mobile web viewports should always display the select as full width so the width class will default to a max-width: 100% here (flex-basis is only needed in desktop). When it gets to the the $tablet breakpoint and larger though, the pre-defined width values will apply.

Copy link
Copy Markdown
Contributor

@jeana-adhoc jeana-adhoc left a comment

Choose a reason for hiding this comment

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

We should enable axeCheck for the component

const defaultArgs = {
'name': 'options',
'value': '',
'message-aria-describedby': 'Optional description text for screen readers',
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.

Do we need to define this for the storybook stories? I can't think of what this could be. I know it's in the architect doc https://github.com/department-of-veterans-affairs/va.gov-team/blob/master/products/platform/design-system/components/va-sort/properties-architecture.md#properties and we have it in the va-select now. If we don't have to define for for the stories, I'd like not to. If we do, let me know and I'll try to come up with something more realistic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jeana-adhoc Nah, we don't need it. I'll remove it. If you decide to put something more realistic there though, just let me know.

Copy link
Copy Markdown
Contributor

@jeana-adhoc jeana-adhoc left a comment

Choose a reason for hiding this comment

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

LGTM!

va-sort component checklist complete (🔒 Google Sheet)

@jamigibbs jamigibbs merged commit 46c36ff into main Feb 10, 2026
7 of 8 checks passed
@jamigibbs jamigibbs deleted the 4637-sort-component branch February 10, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor For a minor Semantic Version change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a sort component for search filter - Development

4 participants