@wordpress/global-styles-ui 是一个 WordPress 模块,提供用于管理全局样式的 UI 组件。它允许开发者通过 React 组件集成全局样式编辑器界面,支持自定义样式、主题默认样式和回调函数。
import { GlobalStylesUI } from '@wordpress/global-styles-ui';
function MyComponent() {
return (
<GlobalStylesUI
value={ userStyles }
baseValue={ themeStyles }
onChange={ handleChange }
/>
);
} UI components for managing WordPress Global Styles.
Install the module:
npm install @wordpress/global-styles-ui --save
import { GlobalStylesUI } from '@wordpress/global-styles-ui';
function MyComponent() {
return (
<GlobalStylesUI
value={ userStyles }
baseValue={ themeStyles }
onChange={ handleChange }
/>
);
}
Main component for the Global Styles editor interface.
Props:
value (GlobalStylesConfig): User’s custom global stylesbaseValue (GlobalStylesConfig): Theme’s default global stylesonChange (Function): Callback when styles changepath (string, optional): Current navigation pathonPathChange (Function, optional): Callback when path changesfontLibraryEnabled (boolean, optional): Enable font library featuresserverCSS (array, optional): Server CSS stylesserverSettings (object, optional): Server settingsSee CONTRIBUTING.md for details.