-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathCustomization.razor
More file actions
62 lines (50 loc) · 2.3 KB
/
Customization.razor
File metadata and controls
62 lines (50 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@page "/docs/theming/customization"
@layout DocsContentLayout
<p>
LumexUI supports a flexible, CSS-first theming system that allows you to customize the look and feel of components using global CSS variables.
These variables can be overridden globally or scoped to specific themes using CSS selectors like class or data-attribute.
</p>
<DocsSection Title="Global theme">
<p>
To override the default design tokens globally, define your CSS variables inside the <code>:root</code> selector.
These values will apply to the entire application.
</p>
<p>CSS variables inside the <code>:root</code> selector represent the light theme.</p>
<CodeSnippet Code="@(new CodeBlock( name: "globals.css", snippet: "customizationGlobal" ))" />
<Preview>
<div class="w-full flex items-center justify-center gap-4">
<LumexButton Radius="@Radius.Medium" Disabled="@true">Default button</LumexButton>
<div class="theme-example-global">
<LumexButton Radius="@Radius.Medium" Disabled="@true">Custom button</LumexButton>
</div>
</div>
</Preview>
</DocsSection>
<DocsSection Title="Custom themes">
<p>
You can define custom themes using CSS selectors like class or data-attribute.
Components inside an element with a matching selector will use the overridden variables.
</p>
<p>For example, to create a custom theme named "orange", you can define the following CSS variables:</p>
<CodeSnippet Code="@(new CodeBlock( name: "orange.css", snippet: "customizationCustom" ))" />
<p>To apply a theme at runtime, toggle the class on a wrapper element such as <code><html></code> or <code><body></code>.</p>
<CodeSnippet Code="@(new CodeBlock( name: "App.razor", snippet: "customizationToggle" ))" />
<CustomThemesPreview />
</DocsSection>
@code {
[CascadingParameter] private DocsContentLayout Layout { get; set; } = default!;
private readonly Heading[] _headings = new Heading[]
{
new("Global theme"),
new("Custom themes")
};
protected override void OnInitialized()
{
Layout.Initialize(
title: "Customization",
category: "Theming",
description: "Customizing the default theme.",
_headings
);
}
}