Skip to content
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

Implement approved tag (pill) styling change #1760

Closed
natalia-fitzgerald opened this issue Oct 2, 2023 · 9 comments · Fixed by #1777
Closed

Implement approved tag (pill) styling change #1760

natalia-fitzgerald opened this issue Oct 2, 2023 · 9 comments · Fixed by #1777
Assignees

Comments

@natalia-fitzgerald
Copy link
Contributor

natalia-fitzgerald commented Oct 2, 2023

In 2018 and 2020 we approved new styling for the pill component. This issue will implement this change in the Design System.

As part of the React component work we have already implemented this update. We would now like to push the change to the Design System. Satellite apps will have to be handled separately but the risk is low given that satellite apps are currently using different styling than the CFPB core website.

Describe the solution you'd like

Updated styling:

  • background-color: Teal/20
  • border-color: Teal/100
  • Add here

Existing CSS for pills

.o-multiselect_choices button {
border: none;
background: none;
padding: 0;

.o-multiselect_choices li {
display: inline-block;
margin-right: 0.625em;
}

.o-multiselect_choices label {
display: inline-block;
padding: 2px 5px;
padding-right: 1.78571429em;
background-color: #5674a3;
border-radius: 0.28571429em;
color: #ffffff;
cursor: pointer;
font-size: 0.875em;
position: relative;
}

.o-multiselect_choices label .cf-icon-svg {
position: absolute;
top: 2px;
right: 5px;
fill: #d3daeb;
}

.cf-icon-svg {
height: 1.1875em;
vertical-align: text-top;
fill: currentcolor;

Mock-up of approved implementation:
Screenshot 2023-10-02 at 2 06 35 PM

@natalia-fitzgerald
Copy link
Contributor Author

natalia-fitzgerald commented Oct 2, 2023

@jenn-franklin
In reviewing the implementation here: https://github.cfpb.gov/CFPB/hubcap/issues/90#issuecomment-266484 I am realizing that a few things have changed since this component change was approved. So I decided to conduct a quick exploration so that we can nail things down.

Button with icon styles:

  • Height: 35px
  • Background color: #0072ce (Pacific 100)
  • Text: Avenir Next, Medium, 16px
  • Pipe separator (between icon and text): Yes

Existing pills (live on the site):

  • Height: 22px
  • Background color: #5674a3 (Navy 80)
  • Text: Avenir Next, Regular, 14px
  • Pipe separator (between icon and text): No
Button with icon Pills (on filterable list)
Screenshot 2023-10-02 at 5 16 40 PM Screenshot 2023-10-02 at 5 07 18 PM

New styling(exploration below)

  • Height: 30px (or 35px)
  • Background color: #d4e7e6 (Teal 20)
  • Text: Avenir Next, Regular (or Medium)
  • Pipe separator (between icon and text): No

Notes:

  1. We deprecated the "Microcopy" level of text. The pills in my original product design used the "Microcopy" text style contained in the Figma template. In order to stay true to the current state I have switched out the text in the pill styling to paragraph text.
  2. Buttons use Medium instead Regular text. In the mock-ups you can see that difference between the pill only designs (use Medium) and the example designs (use Regular).
  3. I noticed that our standard button with icon component uses a pipe character to separate the text from the icon. I wanted to be sure to explore this so that we can be certain we don't want to include it (generally I was trying to use as much from the core button styles as possible and to be deliberate about deviating). My specific use case uses a pipe character to separate 2 values within the label so it's unfortunate. I did a quick exploration of other apps that include versions of a pill and we don't seem to use the pipe separator (CCDB, Prepaid product agreements, TDP. So I'm thinking maybe we don't include it.
No pipe separator Includes pipe separator
No pipe with pipe

My recommendation is that we go with:

  • Height: 30px
  • Background color: #d4e7e6 (Teal 20)
  • Text: Avenir Next, Regular, 16px
  • Pipe separator (between icon and text): No

I think it's better for the pill to be different in height than the button because a button should have prominence and button and pill will typically appear on a form together. The height in my mock-up is 30px. I imagine I could go even less high if needed but 30px is a good start. Since we use Regular for the existing pill I can go with that and see how it works. I can forgo the pipe separator since we aren't using it in any of the existing pill iterations and perhaps it simplifies things.

I'll start by building the component to this spec and then loop back around.

@anselmbradford
Copy link
Member

anselmbradford commented Oct 3, 2023

Height: 30px

Do we have guidance on touch target sizes? My understanding is they are recommended to be a minimum of 44px x 44px. (See material-components/material-components-android#1279, for example.) Does that affect the height we want for the pills?

@natalia-fitzgerald
Copy link
Contributor Author

@anselmbradford
We do have some general guidance on touch target sizes within the large target checkbox and radio button pages: https://cfpb.github.io/design-system/components/checkboxes#behavior.

What is the touch target for our standard button component? Standard buttons are 35px in height (visually) but do you know what we have the touch target size set to? Increasing the touch target for standard buttons is out of scope for this specific effort but I can open a separate issue if that is something you want to explore at this time.

What I am suggesting here is an increase in the existing height of the pills from 22px to 30px. So the touch target would improve with this change, and we could look at extending the area that responds to user input outside of that visual area, if possible, to more closely align with the guidance.

@natalia-fitzgerald
Copy link
Contributor Author

natalia-fitzgerald commented Oct 3, 2023

@anselmbradford @jenn-franklin
I think what I'll do is start building this out using the following specs. Then we can see how it's working.

Specs for R1:

  • Button height: 30px
  • Touch target size (height) - 45px
  • Background color: Team 20 (#d4e7e6) (see other states in mock-up)
  • Text: Avenir Next, Regular, 16px
  • Pipe separator (between icon and text): No

Note: The states shown at the top have not been updated to the 30px height. But the pills in the mock-up below the states example is set to 30px.
pill-mock-up

For discussion
Do you all have any thoughts as to whether this component should live in the buttons section (as a type of button) or maybe even as it's own component called "Tags"? I did some poking around and it seems like these are sort of like tags in many use cases (but perhaps not all use cases). Currently this component lives in the Multiselect section but there are no specific written specs for the pills (or the Multiselect for that matter).

We do use the Multiselect component on our website to filter categorized content, like here where you can filter reports by predefined topics and categories. But some use cases are much broader than that - where we're using the pill to visually indicate that an item (in a list) has been selected. That item does not necessarily represent a group or category of things.

But both use cases will use this same pill component - and the same multiselect component.

@jenn-franklin
Copy link
Member

@natalia-fitzgerald Thanks for working on this and 👍 to all the specs you've chosen. Before reading your spec preferences, I had decided I preferred Teal 20, 30px height and no pipe separator. I was intrigued by Avenir Next Medium, but I don't think it's needed or particularly helpful. Regular weight is accessible and will help keep the design's footprint small. Great to seeing about making the touch target 45px. I think you can do that without going larger than 30px with the visual design. I agree with your comment that this should have less visual prominence than our button.

I like the idea of calling this a tag. Seems like a fitting description to me, and I like aligning with USWDS's naming conventions when possible. It doesn't feel right to me to group this with buttons. It feels to me that it serves a different function and the interaction is kind of the reverse of a button's interaction in that when you click on a tag, you remove something vs. when you click on a button, you advance.

@natalia-fitzgerald
Copy link
Contributor Author

@jenn-franklin
Thanks for sharing your thoughts. That all makes sense and provides what I need to get started.

So if we separate this into a "Tag" component do we need to we need to think bigger picture about what these other tag-related components should be and should be called? That is out of scope for my effort - and it might be that these particular components (3 and 4 below) only appear in the context of the filterable list/post preview. But it's good to be thinking about it/discussing it while we're exploring the tag component.

My effort will address the styling of 1 and 2 below, the "Tag" component for the Multiselect component. In a separate effort we could update the post preview topic tag link to match the teal styling (so that these components seem more visually related (currently the tag/pill is Navy and the topic tag is Gold).

  1. Category tag - Multiselect/Filter (button)
  2. Topic tag - Multiselect/Filter (button)
  3. Meta header - Post preview (label)
  4. Topic tag - Post preview (link)
Blog
Frame 283

@natalia-fitzgerald
Copy link
Contributor Author

natalia-fitzgerald commented Oct 3, 2023

Specs for Tag component:

Default

  • Height: 30px
  • Avenir Next Regular, 16px, (#101820)
  • Background: Teal 20 (#d4e7e6)
  • Top and bottom padding: 10px 4px
  • Left and right padding: 15px 10px
  • Border radius: 4px 3px
  • Outline: Solid 1px, Teal (#257675)
  • Padding between text and “x” icon: 10px

Focus

  • Background: Teal 20 (#d4e7e6)
  • Outline: Dotted 1px, Teal (#257675)
  • Outline offset: 1px

Hover

  • Background: Teal 40 (#b4d2d1)

Hover/Focus

  • Background: Teal 40 (#b4d2d1)
  • Outline: Dotted 1px, Teal (#257675)
  • Outline offset: 1px

Active

  • Background: Teal 60 (#89b6b5)

Screenshot 2023-10-11 at 11 22 44 AM

@shindigira
Copy link
Contributor

.o-multiselect_choices label

Will be using this class selector for styling the pills

@natalia-fitzgerald natalia-fitzgerald changed the title Implement approved pill styling change Implement approved tag (pill) styling change Oct 6, 2023
@natalia-fitzgerald
Copy link
Contributor Author

@meissadia
Updated can be found here:
#1760 (comment)

I think the only change is to the background color for the Focus state. It should be Teal 20.

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 a pull request may close this issue.

5 participants