Mobile Style Modules (mobile
)
Defines the map of mobile-specific SCSS style modules for the theme. The existing value is a map of styles that are loaded first for the theme and set defaults for the presentation.
You can add new keys or replace the values for existing ones. You don’t need to keep the full list of all styles in your own configuration file. Only specify the values you want to add or replace.
JSON Schema
Definition
{
"$id": "https://platen.io/schemas/platen/site/theme/styles/mobile/schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Defines the map of mobile-specific SCSS style modules for the theme.\n\nhttps://platen.io/schemas/platen/site/theme/styles/mobile/",
"patternProperties": {
".": {
"$ref": "https://platen.io/schemas/platen/site/theme/styles/defined/schema.json"
}
},
"properties": {
"header": {
"description": "Defines the style for the page header in mobile view.\n\nhttps://platen.io/schemas/platen/site/theme/styles/mobile/#header",
"title": "Header Style Module",
"type": "object"
},
"menu": {
"description": "Defines the style for the site menu in mobile view.\n\nhttps://platen.io/schemas/platen/site/theme/styles/mobile/#menu",
"title": "Menu Style Module",
"type": "object"
},
"table_of_contents": {
"description": "Defines the style for the table of contents in mobile view\n\nhttps://platen.io/schemas/platen/site/theme/styles/mobile/#table_of_contents",
"title": "Table of Contents Style Module",
"type": "object"
}
},
"title": "Mobile Style Modules",
"type": "object"
}
Header Style Module (header
)
Defines the style for the page header in mobile view. By default, the only setting for this
property is enabled
, which defaults to true
. If you set enabled
to
false
, this style isn’t applied to the site.
With enabled
set to true
, Platen applies the following style to the site:
@media screen and (max-width: $mobile-breakpoint) {
.platen-header {
display: block;
}
}
This applies to the page header, setting its display to block
instead of hidden
in
mobile view.
You can overwrite this definition for your own site or theme by creating the file
styles/mobile/_header.scss
in your assets folder, which defaults to assets
in
your project root.
Note that if you create this file, it entirely overwrites the default from the theme.
For more information on authoring SCSS, see the learning guide.
Table of Contents Style Module (table_of_contents
)
Defines the style for the table of contents in mobile view. By default, the only setting for
this property is enabled
, which defaults to true
. If you set enabled
to
false
, this style isn’t applied to the site.
With enabled
set to true
, Platen applies the following style to the site:
@media screen and (max-width: $mobile-breakpoint) {
#toc-control {
display: inline;
}
.platen-toc {
display: none;
}
#toc-control:focus ~ main label[for="toc-control"] {
@include outline;
}
#toc-control:checked ~ main {
.platen-header aside {
display: block;
}
}
}
This applies to the table of contents in mobile view, overriding the styles defined in
theme.styles.platen.table_of_contents
.
ToC Container #
.platen-toc {
display: none;
}
This hides the table of contents by default in mobile view.
ToC Control #
#toc-control {
display: inline;
}
This ensures the ToC control element (the logo) is displayed instead of hidden.
#toc-control:focus ~ main label[for="toc-control"] {
@include outline;
}
This adds an outline to the control when focused, as with a keyboard.
ToC Display #
#toc-control:checked ~ main {
.platen-header aside {
display: block;
}
}
This applies only when the toggle is checked to display the table of contents. It displays
the ToC at the top of the page as a block
element before the content.
Overwriting #
You can overwrite this definition for your own site or theme by creating the file
styles/mobile/_toc.scss
in your assets folder, which defaults to assets
in
your project root.
Note that if you create this file, it entirely overwrites the default from the theme.
For more information on authoring SCSS, see the learning guide.
Pattern Properties
Defined Style Module (pattern-any
)
All existing style modules, and any style module you add, must define the enabled
property at a minimum. This allows theme developers and site maintainers to toggle individual
style modules on and off. You can add other key-values pairs to control how the style module
behaves, if you want. Those values will be available to the module when it’s processed as a
template.
For more information, see Defined Style Module