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

Add kbd styling and/or component #5016

Closed
j-m opened this issue Aug 11, 2021 · 3 comments · Fixed by #6049
Closed

Add kbd styling and/or component #5016

j-m opened this issue Aug 11, 2021 · 3 comments · Fixed by #6049
Assignees

Comments

@j-m
Copy link
Contributor

j-m commented Aug 11, 2021

I would like there to be styling for the kbd tag so I can indicate shortcuts like:
Alt + A

Looking at the Figma (code page) there is also a note that says this needs to be done
image
(also kinda briefly mentioned in #1573)

Currently the only styling is

code, pre, kbd, samp {
    font-family: "Roboto Mono", Consolas, Menlo, Courier, monospace;
}

The linked code

  kbd {
    padding: 0.2em;
    border: $euiBorderThin;
    border-bottom-color: shadeOrTint($euiColorLightShade, 10%, 10%);
    border-radius: $euiBorderRadius;
    box-shadow: inset 0 -1px 0 $euiColorLightShade;
  }

is not in EUI (or at least in the non-Amsterdam theme)

I thought I'd raise an issue as I couldn't find one.

It might be good if we could create a new component to limit what combinations we can use - I doubt it's good for people to use <kbd> for non-shortcuts e.g.

<EuiKeyboard 
  char: 'A' | 'B' | 'C' ...
  ctrl?: boolean
  shift?: boolean
  alt?: boolean 
  win?: boolean
  cmd?: boolean
/>
@miukimiu
Copy link
Contributor

Thanks, @j-m for suggesting this component.

I think we could only style better the <kbd> tag and inherit the text size and color based on EuiText.

It might be good if we could create a new component to limit what combinations we can use - I doubt it's good for people to use <kbd> for non-shortcuts e.g.

IMO just the <kbd> tag would work. I don't see a reason to create a component and limit the combinations. I guess combinations are hard to predict so let's assume EUI consumers are going to use the tag for what is expected. 🙂

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@miukimiu
Copy link
Contributor

miukimiu commented Jul 12, 2022

Just to follow up on this issue I created a component spec that can be found here.

I decided to create a component instead of just styling the <kbd> tag

I'll keep the discussion in #6049.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants