UI: Support to disable container style overriding

This commit is contained in:
fuma-nama
2024-07-26 22:23:38 +08:00
parent 70b048f782
commit c684c00a20
2 changed files with 27 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': minor
---
Support to disable container style overriding
+22 -15
View File
@@ -20,6 +20,13 @@ interface DocsUIOptions {
*/
addGlobalColors?: boolean;
/**
* Change the default styles of `container`
*
* @defaultValue true
*/
modifyContainer?: boolean;
/**
* Color preset
*/
@@ -205,23 +212,23 @@ export const docsUi = plugin.withOptions<DocsUIOptions>(
});
};
},
({ cssPrefix = '', addGlobalColors = false } = {}) => ({
({
cssPrefix = '',
modifyContainer = true,
addGlobalColors = false,
} = {}) => ({
theme: {
extend: {
// Allow devs to use `container` for other elements
container: {
center: true,
padding: '1rem',
screens: {
'2xl': '1400px',
},
},
height: {
body: [
'calc(100vh - 4rem) /* fallback */',
'calc(100dvh - 4rem)',
] as unknown as string,
},
// Allow devs to use `container` to match with home layout
container: modifyContainer
? {
center: true,
padding: '1rem',
screens: {
'2xl': '1400px',
},
}
: undefined,
maxWidth: {
container: '1400px',
},