Skip to content

Instantly share code, notes, and snippets.

@MatthieuScarset
Created May 26, 2024 18:35
Show Gist options
  • Save MatthieuScarset/6282ec2488a36faf90ecd102730d1037 to your computer and use it in GitHub Desktop.
Save MatthieuScarset/6282ec2488a36faf90ecd102730d1037 to your computer and use it in GitHub Desktop.
HTML - Details with custom marker styling
details {
border: 0;
summary {
position: relative;
cursor: pointer;
padding: 0;
}
summary > * {
display: inline-block;
}
summary::marker {
content: none;
}
&[open] summary i {
transform: rotate(45deg);
}
}
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
]
%}
{% set title_attributes = title_attributes ?? create_attribute() %}
{% set content_attributes = content_attributes ?? create_attribute() %}
<details{{ attributes.addClass(classes) }}>
<summary{{ title_attributes.addClass('d-flex', 'flex-nowrap', 'align-items-center', 'justify-content-between', 'py-1') }}>
<strong>{{ node.label() }}</strong>
<i aria-hidden="true" class="icon-cross"></i>
</summary>
<div{{ content_attributes.addClass('container', 'p-2') }}>
{{ content }}
</div>
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment