Skip to content

feat: ✨ add sd-navigation-item #346

@mariohamann

Description

@mariohamann

Description

The sd-navigation-item is a flexible component, that can be used to quickly build navigations. Examples of the item are available on Figma: https://www.figma.com/file/2hDs56yh73azMZafmpvEeU/Rework-Navigation?type=design&node-id=750-40814&mode=design&t=p1jVFPsX1m2c2TTq-4

This component doesn't provide stuff like flyouts, but instead only has the "content" of a navigation in mind.

API

The API will soon be provided in another file, but we can start already with the one over here which was discussed and approved today: https://www.figma.com/file/cvr5GpzGeJzbWIPyi5MhGY/navigation-item?type=design&node-id=0-1&mode=design&t=hENJEUnDugfazCvx-11

CleanShot 2023-08-24 at 14 42 36@2x

Props

The most important difference is the horizontal prop. If set, it can be used for top navigations. If selected, the API is very reduced:

  • disabled
  • current: green line at the bottom

If the element is not horizontal, the component can have a lot more options:

  • disabled
  • current: green line at the left
  • chevron: on dev side, this might be just a boolean, as the "accordion"-functionality could be provided with a children-slot
  • nested: this just provides additional padding
  • size: base (default), lg, 14px
  • divider: sets a divider at the top which reflects nestedness etc.

If current is set, aria-current should be added.

Slots

For vertical and horizontal the main slot is available.

The main slot can be used to set additional content like badges.
CleanShot 2023-08-22 at 11 35 22@2x

The vertical navigation-item in addition can have a description slot. It can be used to offer additional descriptions e. g. in mega menus or in sidebars as well.

CleanShot 2023-08-22 at 11 40 42@2x

The icons should be slottable as well for themability.

I would suggest implementing a children slot, where people can drop-in other sd-navigation-items. If there's something in the children slot, the chevron should show up as like in the accordion. To implement the functionality, I would suggest to use browser-built-in details and summary elements for that, to build it as fast as possible. (That's something Shoelace does in its newest version of the sl-accordion, too.)

Functionality

This is a tough one. So – the whole element should be hoverable and clickable.
When a href is provided, it will be a link, if not, it is a button, like we did for the sd-button and the sd-tag.

This is only relevant if the element doesn't have something in the children slot.

See comment below.

People should of course be able to listen to an event if there is a button.

Hand-off

The tokens hand-off will be provided soon – most of the stuff can be read from the colors already. I would propose to start measuring by eye and make the hot-potato-approach instead of doing the component only waterfally.

Components detailed requirements

  • Props
    • horizontal
    • disabled
    • current
    • chevron
    • size
    • indentend
    • relaxed
    • divider
  • CSS-Properties
    • ...
  • Parts
    • chevron
    • icon-left
    • icon-right
    • description
    • content
    • ...
  • Slots
    • icons in different states (see sd-accordion)
    • default
    • main
    • description
    • children? (only if we don't use nested)
  • Stories
    • default - slot with bold everywhere (needs to be properly documented)
    • default and bold - comparison between the two
    • show how to override the hover color via parts selector to match CleanShot 2023-08-23 at 20 36 45@2x
  • Samples
    • horizontal first level (add documentation/hint to the sample which clarifies that the sds currently only provides first level and multi-level horizontal navigation will be provided in the future together with the flyout)
    • vertical behaviour including going one level deeper and swapping content

DoR

  • Item has business value
  • Item has been estimated by the team
  • Item is clear and well-defined
  • Item dependencies have been identified

DoD

  • Documentation has been created/updated (if applicable)
  • Migration Guide has been created/updated (if applicable)
  • Relevant E2E tests (Features, A11y, Bug fixes) are created/updated
  • Relevant stories (Features, A11y) are created/updated
  • Implementation works successfully on feature branch

Metadata

Metadata

Assignees

Labels

CL-MigrationAll components which need to be migrated from Component LibraryDesignneeds changes in Figma

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions