Skip to content

Commit

Permalink
📝 [#5066] Update frontend documentation
Browse files Browse the repository at this point in the history
Added a (short) section on how to add custom styling of admin components.
  • Loading branch information
viktorvanwijk committed Feb 4, 2025
1 parent 1013703 commit 820f230
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/developers/frontend/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,38 @@ This script can handle current and future NPM packages published in the
.. _FormatJS: https://formatjs.github.io/
.. _react-intl: https://formatjs.github.io/docs/getting-started/installation
.. _react-intl storybook addon: https://storybook.js.org/addons/storybook-react-intl

Admin styling
=============
Custom styling of admin components can be realized by adding/updating .scss files,
which are located in ``path/to/open-forms/src/openforms/scss``.

Adding a custom style
---------------------
See below for an example on adding custom styling for a ``div`` component in the admin:

.. code-block:: html

<div className="json-dump-variables json-dump-variables--horizontal">
...
</div>

1. Create a file called ``_json-dump-variables.scss`` in ``../scss/components/admin``

2. Add styling, for example::

.json-dump-variables {
display: flex;

&--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 (in this case ``../scss/components/admin/_index.scss``)::

...
@import './json-dump-variables';
...

0 comments on commit 820f230

Please sign in to comment.