-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 [#5066] Update frontend documentation
Added a (short) section on how to add custom styling of admin components.
- Loading branch information
1 parent
219a2b5
commit 3819dac
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. _developers_frontend_admin_styling: | ||
|
||
Admin styling | ||
============= | ||
Custom styling of admin components can be realized by adding/updating .scss files, | ||
which are located in ``src/openforms/scss``. | ||
|
||
Adding a custom style | ||
--------------------- | ||
The steps below describe how to add custom styling for a component in the admin, with the | ||
help of an example ``div`` component: | ||
|
||
.. code-block:: html | ||
|
||
<div className="json-dump-variables json-dump-variables--horizontal"> | ||
... | ||
</div> | ||
|
||
1. Create a new file called ``_component-file-name.scss`` in ``src/openforms/scss/components/admin``, | ||
where ``component-file-name`` reflects the class name of the component. For example: ``_json-dump-variables.scss`` | ||
|
||
2. Add the custom styling. For example: | ||
|
||
.. code-block:: scss | ||
.json-dump-variables { | ||
display: flex; | ||
@include bem.modifier('horizontal') { | ||
align-items: center; | ||
gap: 0.5em; | ||
} | ||
} | ||
3. To ensure it gets picked up, add an import of the file name (without underscore) to the ``_index.scss`` | ||
file of the parent directory. For example, in ``src/openforms/scss/components/admin/_index.scss``): | ||
|
||
.. code-block:: scss | ||
... | ||
@import './json-dump-variables'; | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters