diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md
index ba2b26811d7..e8f5caeb423 100644
--- a/CHANGELOG-WIP.md
+++ b/CHANGELOG-WIP.md
@@ -1,6 +1,8 @@
# Release Notes for Craft CMS 5.0.0 (WIP)
### Content Management
+- Improved global sidebar styling. ([#14281](https://github.com/craftcms/cms/pull/14281))
+- The global sidebar is now collapsible. ([#14281](https://github.com/craftcms/cms/pull/14281))
- Redesigned the global breadcrumb bar to include quick links to other areas of the control panel, page context menus, and action menus. ([#13902](https://github.com/craftcms/cms/pull/13902))
- All elements can now have thumbnails, provided by Assets fields. ([#12484](https://github.com/craftcms/cms/discussions/12484), [#12706](https://github.com/craftcms/cms/discussions/12706))
- Element indexes and relational fields now have the option to use card views. ([#6024](https://github.com/craftcms/cms/pull/6024))
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 551dae0cd5c..6557c074c9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+- Improved global sidebar styling. ([#14281](https://github.com/craftcms/cms/pull/14281))
+- The global sidebar is now collapsible. ([#14281](https://github.com/craftcms/cms/pull/14281))
- Added `Craft.ElementEditor::markDeltaNameAsModified()`.
- Removed `craft\elements\NestedElementManager::$allowDeletion`.
- Fixed a bug where element editor forms could submit duplicate input values. ([#14276](https://github.com/craftcms/cms/issues/14276))
diff --git a/src/templates/_components/fieldtypes/Categories/input.twig b/src/templates/_components/fieldtypes/Categories/input.twig
index 6dd85eb1846..291653c47e9 100644
--- a/src/templates/_components/fieldtypes/Categories/input.twig
+++ b/src/templates/_components/fieldtypes/Categories/input.twig
@@ -43,8 +43,8 @@
{% if jsClass is defined %}
{% js %}
new {{ jsClass }}({
- id: "{{ id | namespaceInputId | e('js') }}",
- name: "{{ name | namespaceInputName | e('js') }}",
+ id: "{{ id|namespaceInputId|e('js') }}",
+ name: "{{ name|namespaceInputName|e('js') }}",
elementType: "{{ elementType|e('js') }}",
sources: {{ sources|json_encode|raw }},
criteria: {{ criteria|json_encode|raw }},
diff --git a/src/templates/_includes/disclosuremenu.twig b/src/templates/_includes/disclosuremenu.twig
index 8c21cd86cd6..9d246f0b43a 100644
--- a/src/templates/_includes/disclosuremenu.twig
+++ b/src/templates/_includes/disclosuremenu.twig
@@ -82,7 +82,7 @@
{% if withButton %}
{% if html ?? false %}
- {{ html | raw }}
+ {{ html|raw }}
{% elseif label ?? false %}
{{ label }}
{% endif %}
@@ -143,7 +143,7 @@
{% if item.heading is defined %}
{% tag headingTag with {
class: ['h6', 'padded'],
- } | merge(item.headingAttributes ??{}, recursive=true) %}
+ }|merge(item.headingAttributes ??{}, recursive=true) %}
{{ item.heading }}
{% endtag %}
{% endif %}
diff --git a/src/templates/_includes/links.twig b/src/templates/_includes/links.twig
index 90007f7f9db..bb34c2d43fb 100644
--- a/src/templates/_includes/links.twig
+++ b/src/templates/_includes/links.twig
@@ -1,6 +1,7 @@
{% macro externalLinkIcon() %}
{{ tag('span', {
'data-icon': 'external',
+ 'data-icon-size': 'puny',
'role': 'img',
'aria-label': 'Opens in a new window'|t('app'),
}) }}
diff --git a/src/templates/_layouts/base.twig b/src/templates/_layouts/base.twig
index dd516b0a007..989dd5a460f 100644
--- a/src/templates/_layouts/base.twig
+++ b/src/templates/_layouts/base.twig
@@ -12,11 +12,16 @@
requestedSite ? "site--#{requestedSite.handle}",
])|filter -%}
+{% set sidebarState = craft.app.request.rawCookies.value('Craft-' ~ craft.app.systemUid ~ ':sidebar') ?? 'expanded' %}
{% set bodyAttributes = {
class: bodyClass,
dir: orientation,
+ data: {
+ sidebar: sidebarState
+ }
}|merge(bodyAttributes ?? {}, recursive=true) -%}
+
{% do view.registerAssetBundle('craft\\web\\assets\\cp\\CpAsset') -%}
{% set cpAssetUrl = view.getAssetManager().getPublishedUrl('@app/web/assets/cp/dist', true) -%}
diff --git a/src/templates/_layouts/components/global-sidebar.twig b/src/templates/_layouts/components/global-sidebar.twig
index 2d6dd5a8939..333113e9c78 100644
--- a/src/templates/_layouts/components/global-sidebar.twig
+++ b/src/templates/_layouts/components/global-sidebar.twig
@@ -1,107 +1,129 @@
-