Skip to content

Best practice for sl-dropdown menu item text wrap #676

Answered by claviska
SabineWren asked this question in Help
Discussion options

You must be logged in to vote

Try targeting the menu item's label.

sl-menu-item::part(label) {
  width: max-content;
  max-width: 400px;
  white-space: normal; 
}

Example

I think it's reasonable (and good UX) to provide a maximum width. The max-content handles the rest.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SabineWren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants