diff --git a/renderers/react/src/v0_9/A2uiSurface.tsx b/renderers/react/src/v0_9/A2uiSurface.tsx index 125593371..16bda2cf6 100644 --- a/renderers/react/src/v0_9/A2uiSurface.tsx +++ b/renderers/react/src/v0_9/A2uiSurface.tsx @@ -127,6 +127,18 @@ DeferredChild.displayName = 'DeferredChild'; export const A2uiSurface: React.FC<{surface: SurfaceModel}> = ({ surface, }) => { + const themeStyle = useMemo(() => { + const style: Record = {}; + if (surface.theme?.primaryColor) { + style['--a2ui-primary-color'] = surface.theme.primaryColor; + } + return style; + }, [surface.theme]); + // The root component always has ID 'root' and base path '/' - return ; + return ( +
+ +
+ ); }; diff --git a/renderers/react/src/v0_9/catalog/basic/components/Button.tsx b/renderers/react/src/v0_9/catalog/basic/components/Button.tsx index b6489cf77..cc9cae9f4 100644 --- a/renderers/react/src/v0_9/catalog/basic/components/Button.tsx +++ b/renderers/react/src/v0_9/catalog/basic/components/Button.tsx @@ -17,7 +17,7 @@ import React from 'react'; import {createReactComponent} from '../../../adapter'; import {ButtonApi} from '@a2ui/web_core/v0_9/basic_catalog'; -import {LEAF_MARGIN} from '../utils'; +import {LEAF_MARGIN, PRIMARY_COLOR} from '../utils'; export const Button = createReactComponent(ButtonApi, ({props, buildChild}) => { const style: React.CSSProperties = { @@ -27,7 +27,7 @@ export const Button = createReactComponent(ButtonApi, ({props, buildChild}) => { border: props.variant === 'borderless' ? 'none' : '1px solid #ccc', backgroundColor: props.variant === 'primary' - ? 'var(--a2ui-primary-color, #007bff)' + ? PRIMARY_COLOR : props.variant === 'borderless' ? 'transparent' : '#fff', diff --git a/renderers/react/src/v0_9/catalog/basic/components/CheckBox.tsx b/renderers/react/src/v0_9/catalog/basic/components/CheckBox.tsx index 1c1a9da03..a2c4b0ea3 100644 --- a/renderers/react/src/v0_9/catalog/basic/components/CheckBox.tsx +++ b/renderers/react/src/v0_9/catalog/basic/components/CheckBox.tsx @@ -17,7 +17,7 @@ import React from 'react'; import {createReactComponent} from '../../../adapter'; import {CheckBoxApi} from '@a2ui/web_core/v0_9/basic_catalog'; -import {LEAF_MARGIN} from '../utils'; +import {LEAF_MARGIN, PRIMARY_COLOR} from '../utils'; export const CheckBox = createReactComponent(CheckBoxApi, ({props}) => { const onChange = (e: React.ChangeEvent) => { @@ -36,7 +36,7 @@ export const CheckBox = createReactComponent(CheckBoxApi, ({props}) => { type="checkbox" checked={!!props.value} onChange={onChange} - style={{cursor: 'pointer', outline: hasError ? '1px solid red' : 'none'}} + style={{cursor: 'pointer', outline: hasError ? '1px solid red' : 'none', accentColor: PRIMARY_COLOR}} /> {props.label && (