Skip to content

Add kbd styling and/or component #5016

Closed

Description

@j-m

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
/>

Activity

  1. elizabetdev commented on Aug 11, 2021

    @elizabetdev
    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. 🙂

  2. github-actions commented on Feb 7, 2022

    @github-actions

    👋 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.

  3. added
    stale-issue
    on Feb 7, 2022
  4. added and removed
    stale-issue
    on Feb 7, 2022
  5. self-assigned this
    on Jul 12, 2022
  6. elizabetdev commented on Jul 12, 2022

    @elizabetdev
    Contributor

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions