Skip to content

Conversation

@Infi-Knight
Copy link
Contributor

@Infi-Knight Infi-Knight commented Jan 9, 2026

This PR enhances the <details> element styling to improve visibility.

Key Changes
Fixes #52: Resolved misalignment when the summary is followed by block elements (images/code).
Interactive States: Added hover-based transitions. The left border now accents on hover, and the indicator highlights to the text color.
Improved UI: Replaced the default marker with a fluid SVG chevron and set a transparent background for better harmony with nested components.
Versioning: Bumped package to 0.11.0

details.demo.mov

TODO:

  • update style-guide once the package is published
  • update docs websites with the new package

@Infi-Knight Infi-Knight self-assigned this Jan 9, 2026
@Infi-Knight Infi-Knight added the enhancement New feature or request label Jan 9, 2026
display: inline-block;
vertical-align: middle;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new changes


:root[data-theme="light"],
[data-theme="light"] ::backdrop {
:root[data-theme='light'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier formatter changes

@Infi-Knight Infi-Knight marked this pull request as ready for review January 12, 2026 14:16
@melissahenderson
Copy link

I'd prefer to not have hover-based color changes or use something more prominent than gray. We really want the detail element to stand out from the surrounding text and gray code blocks.

I think having the greenish left color even when not being hovered over achieves that. Plus, without the green color, the dark mode version doesn't stand out much.

border-left: 4px solid var(--sl-color-gray-5);
border-radius: 6px;
background: transparent;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

.sl-markdown-content details {
border: 1px solid var(--sl-color-gray-5);
border-left: 4px solid var(--sl-color-gray-5);
border-radius: 6px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
border-radius: 6px;
border-radius: var(--border-radius);

border-radius: 6px;
background: transparent;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
transition: border-color 0.2s ease, box-shadow 0.2s ease;
transition: border-color 0.2s ease;


.sl-markdown-content details:hover {
border-left-color: var(--sl-color-text-accent);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);

.sl-markdown-content details summary {
cursor: pointer;
position: relative;
padding: 1rem 2.5rem 1rem 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding: 1rem 2.5rem 1rem 0;
padding: 1rem 0 1rem 2.5rem;

.sl-markdown-content details summary::before {
content: '';
position: absolute;
right: 1rem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
right: 1rem;
left: 1rem;

@JoblersTune
Copy link
Contributor

I also saw the focus outline needs more padding
image

And if we're moving to left alignment of the chevron icon we need to ensure it is vertically centered with the text when it is expanded
image

@JoblersTune
Copy link
Contributor

The decision is to use the colors that Radu defined for the hover state as the only state for the element. No hover effect. On click the chevron arrow will rotate as it does now. Keep the border, lose the box shadow

@Infi-Knight
Copy link
Contributor Author

Infi-Knight commented Jan 15, 2026

Screen.Recording.2026-01-15.at.7.24.35.PM.mov
Screenshot 2026-01-15 at 7 29 40 PM

@Infi-Knight Infi-Knight merged commit 72a2921 into main Jan 19, 2026
1 check passed
@Infi-Knight Infi-Knight deleted the ravi/details_element_redesign branch January 19, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Better styling for the <details> element

4 participants