Skip to content

Add example code and resulting screenshot for theme extension #2261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docusaurus/docs/dev-docs/admin-panel-customization/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,58 @@ To extend the theme, use either:
:::strapi Strapi Design System
The default [Strapi theme](https://github.com/strapi/design-system/tree/main/packages/design-system/src/themes) defines various theme-related keys (shadows, colors…) that can be updated through the `config.theme.light` and `config.theme.dark` keys in `./admin/src/app.js`. The [Strapi Design System](https://design-system.strapi.io/) is fully customizable and has a dedicated [StoryBook](https://design-system-git-main-strapijs.vercel.app) documentation.
:::

<details>
<summary>Example: Customizing some admin panel colors:</summary>

With the following code example, buttons and links that would use some primary colors will be displayed in red, as shown in the example screenshot:

<Tabs groupId="js-ts">

<TabItem value="js" label="JavaScript">

```tsx title="/src/admin/app.js"
export default {
config: {
theme: {
light: {
colors: {
primary600: "red",
buttonPrimary500: "red",
buttonPrimary600: "red",
},
},
},
},
bootstrap() {},
};
```

</TabItem>

<TabItem value="ts" label="TypeScript">

```tsx title="/src/admin/app.ts"
import type { StrapiApp } from "@strapi/strapi/admin";

export default {
config: {
theme: {
light: {
colors: {
primary600: "red",
buttonPrimary500: "red",
buttonPrimary600: "red",
},
};
},
},
bootstrap (app: StrapiApp) {},
}
```

</TabItem>
</Tabs>

![Custom buttons in red](/img/assets/admin-panel-customization/red-login-button.png)
</details>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.