Skip to main content

Namespace: react

@headstartwp/core.react

@headstartwp/core/react

The react export of the @headstartwp/core package.

Usage

import { BlocksRenderer } from "@headstartwp/core/react";

Interfaces

Blocks

AudioBlock

AudioBlock(props): Element

The AudioBlock components implements block parsing for the Audio block.

This component must be used within a BlocksRenderer component.

<BlocksRenderer html={html}>
<AudioBlock component={DebugComponent} />
</BlocksRenderer>

Parameters

NameTypeDescription
propsIAudioBlockComponent properties

Returns

Element

Defined in

packages/core/src/react/blocks/AudioBlock.tsx:58


ButtonBlock

ButtonBlock(props): Element

The ButtonBlock component implements block parsing for the Button block.

This component must be used within a BlocksRenderer component.

<BlocksRenderer html={html}>
<ButtonBlock component={DebugComponent} />
</BlocksRenderer>

Parameters

NameTypeDescription
propsIButtonBlockComponent properties

Returns

Element

Defined in

packages/core/src/react/blocks/ButtonBlock.tsx:62


ButtonsBlock

ButtonsBlock(props): Element

The ButtonsBlock component implements block parsing for the Buttons block.

This component must be used within a BlocksRenderer component.

<BlocksRenderer html={html}>
<ButtonsBlock component={DebugComponent} />
</BlocksRenderer>

Parameters

NameTypeDescription
propsIButtonsBlockComponent properties

Returns

Element

Defined in

packages/core/src/react/blocks/ButtonsBlock.tsx:28


CodeBlock

CodeBlock(props): Element

The CodeBlock component implements block parsing for the core/code block.

This component must be used within a BlocksRenderer component.

<BlocksRenderer html={html}>
<CodeBlock component={DebugComponent} />
</BlocksRenderer>

Parameters

NameTypeDescription
propsICodeBlockComponent properties

Returns

Element

Defined in

packages/core/src/react/blocks/CodeBlock.tsx:32

Data Fetching Hooks

useFetch

useFetch<E, Params, R>(params, fetchStrategy, options?, path?): Object

The use Fetch Hook is the foundation for most hooks in the headless framework. It is a wrapper around useSWR and provides a consistent API for fetching data from the API. It requires a fetch strategy which implements the actual data fetching logic

Type parameters

NameType
EE
Paramsextends EndpointParams
RE

Parameters

NameTypeDefault valueDescription
params{} | ParamsundefinedThe list of params to pass to the fetch strategy. It overrides the ones in the URL.
fetchStrategyAbstractFetchStrategy<E, Params, R>undefinedThe fetch strategy.
optionsFetchHookOptions<FetchResponse<R>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.

Returns

Object

NameTypeDescription
dataundefined | FetchResponse<R>The returned data of the fetcher function.
erroranyThe error object thrown by the fetcher function.
isLoadingboolean-
isMainQueryboolean-
isValidatingboolean-
mutateKeyedMutator<FetchResponse<R>>-
paramsPartial<Params>-

Defined in

packages/core/src/react/hooks/useFetch.ts:30


useFetchAppSettings

useFetchAppSettings<T, P>(params?, options?): useAppSettingsResponse<T>

The useAppSettings hook

See useAppSettings

Type parameters

NameType
Textends AppEntity = AppEntity
Pextends EndpointParams = EndpointParams

Parameters

NameTypeDescription
params{} | PThe list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T>>The options to pass to the swr hook.

Returns

useAppSettingsResponse<T>

Defined in

packages/core/src/react/hooks/useFetchAppSettings.ts:23


useFetchMenu

useFetchMenu(menuLocation, options?): useMenuResponse

The useFetchMenu hooks. Returns a Menu object.

Parameters

NameTypeDescription
menuLocationstringThe slug of the menu location you want to fetch
optionsFetchHookOptions<FetchResponse<AppEntity>>SWR configuration options

Returns

useMenuResponse

Defined in

packages/core/src/react/hooks/useFetchMenu.ts:50


useFetchPosts

useFetchPosts<T, P>(params?, options?, path?, fetcher?): usePostsResponse<T>

The useFetchPosts hook. Returns a collection of post entities

See usePosts for usage instructions.

Type parameters

NameType
Textends PostEntity = PostEntity
Pextends PostsArchiveParams = PostsArchiveParams

Parameters

NameTypeDefault valueDescription
params{} | P{}The list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T[]>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.
fetcherundefined | PostsArchiveFetchStrategy<T, P>undefinedThe fetch strategy to use. If none is passed, the default one is used

Returns

usePostsResponse<T>

Defined in

packages/core/src/react/hooks/useFetchPosts.ts:81


useFetchSearch

useFetchSearch<T, P>(params?, options?, path?): useSearchResponse<T>

The useFetchSearch hook. Returns a collection of post entities

See useSearch for usage instructions.

Type parameters

NameType
Textends PostEntity = PostEntity
Pextends PostsArchiveParams = PostsArchiveParams

Parameters

NameTypeDefault valueDescription
params{} | P{}The list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T[]>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.

Returns

useSearchResponse<T>

Defined in

packages/core/src/react/hooks/useFetchSearch.ts:34


useFetchSearchNative

useFetchSearchNative<T, P>(params?, options?, path?): useSearchNativeResponse<T>

The useFetchSearchNative hook. Returns a collection of search entities retrieved through the WP native search endpoint

See useSearchNative for usage instructions.

Type parameters

NameType
Textends PostSearchEntity | TermSearchEntity = PostSearchEntity | TermSearchEntity
Pextends SearchParams = SearchParams

Parameters

NameTypeDefault valueDescription
params{} | P{}The list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T[]>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.

Returns

useSearchNativeResponse<T>

Defined in

packages/core/src/react/hooks/useFetchSearchNative.ts:37


useFetchTerms

useFetchTerms<T, P>(params, options?, path?): useTermsResponse<T>

The useFetchTerms hook. Returns a collection of term entities

See useTerms for usage instructions.

Type parameters

NameType
Textends TermEntity = TermEntity
Pextends TaxonomyArchiveParams = TaxonomyArchiveParams

Parameters

NameTypeDefault valueDescription
params{} | PundefinedThe list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T[]>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.

Returns

useTermsResponse<T>

Defined in

packages/core/src/react/hooks/useFetchTerms.ts:31

Other

Align

Ƭ Align: "none" | "left" | "center" | "right" | "wide" | "full"

Defined in

packages/core/src/react/blocks/types.ts:15


Border

Ƭ Border: Object

Type declaration

NameType
radius?string
style?string
width?string

Defined in

packages/core/src/react/blocks/types.ts:65


DataFetchingProviderProps

Ƭ DataFetchingProviderProps: Object

Type declaration

NameTypeDescription
dataSWRConfiguration["fallback"]-
swrConfigSWRConfigurationPass any configuration to the SWR library. Globally. These settings can be overridden at the hook level.

Defined in

packages/core/src/react/provider/DataFetchingProvider.tsx:6


ItemWrapper

Ƭ ItemWrapper: (props: ItemWrapperProps) => JSX.Element

Type declaration

▸ (props): JSX.Element

Parameters
NameType
propsItemWrapperProps
Returns

JSX.Element

Defined in

packages/core/src/react/components/Menu.tsx:15


ItemWrapperProps

Ƭ ItemWrapperProps: PropsWithChildren<{ className: string ; depth: number ; item: MenuItemEntity }>

Defined in

packages/core/src/react/components/Menu.tsx:10


Ƭ LinkWrapper: (props: LinkWrapperProps) => JSX.Element

Type declaration

▸ (props): JSX.Element

Parameters
NameType
propsLinkWrapperProps
Returns

JSX.Element

Defined in

packages/core/src/react/components/Menu.tsx:27


LinkWrapperProps

Ƭ LinkWrapperProps: PropsWithChildren<{ depth: number ; href: string }>

Defined in

packages/core/src/react/components/Menu.tsx:23


Ƭ MenuItemsProp: Object

Type declaration

NameType
depthnumber
itemWrapperItemWrapper
itemsMenuItemEntity[]
linkWrapperLinkWrapper
menuWrapperMenuWrapper
topLevelItemsClickableboolean

Defined in

packages/core/src/react/components/Menu.tsx:29


Ƭ MenuWrapper: (props: MenuWrapperProps) => JSX.Element

Type declaration

▸ (props): JSX.Element

Parameters
NameType
propsMenuWrapperProps
Returns

JSX.Element

Defined in

packages/core/src/react/components/Menu.tsx:21


Ƭ MenuWrapperProps: PropsWithChildren<{ className: string ; depth: number }>

Defined in

packages/core/src/react/components/Menu.tsx:17


PageType

Ƭ PageType: Object

Type declaration

NameTypeDescription
isAuthorArchivebooleanAuthor Archive
isCategoryArchivebooleanCategory Archive
isPostArchivebooleanRegular post archive
isPostTypeArchivebooleanCustom Post Type Archive
isSearchbooleanSearch route
isTagArchivebooleanTag Archive
isTaxonomyArchivebooleanCustom Taxonomy Archive
postTypestringWhich post type this archive is for
taxonomystringWhich taxonomy this archive is for

Defined in

packages/core/src/react/hooks/useFetchPosts.ts:20


SettingsColorPalette

Ƭ SettingsColorPalette: Object

Type declaration

NameType
default?SettingsColorPreset[]
theme?SettingsColorPreset[]
user?SettingsColorPreset[]

Defined in

packages/core/src/react/provider/types.ts:47


SettingsColorPreset

Ƭ SettingsColorPreset: Object

Type declaration

NameTypeDescription
colorstringCSS hex or rgb(a) string.
namestringName of the color preset, translatable.
slugstringKebab-case unique identifier for the color preset.

Defined in

packages/core/src/react/provider/types.ts:32


SettingsContextProps

Ƭ SettingsContextProps: { imageComponent?: React.FC<IImageBlock> ; linkComponent?: ReactNode } & HeadlessConfig

Defined in

packages/core/src/react/provider/types.ts:5


SettingsDuotone

Ƭ SettingsDuotone: Object

Type declaration

NameType
default?SettingsDuotonePreset[]
theme?SettingsDuotonePreset[]
user?SettingsDuotonePreset[]

Defined in

packages/core/src/react/provider/types.ts:89


SettingsDuotonePreset

Ƭ SettingsDuotonePreset: Object

Type declaration

NameTypeDescription
colorsstring[]List of colors from dark to light.
namestringName of the duotone preset, translatable.
slugstringKebab-case unique identifier for the duotone preset.

Defined in

packages/core/src/react/provider/types.ts:74


SettingsGradient

Ƭ SettingsGradient: Object

Type declaration

NameType
default?SettingsGradientPreset[]
theme?SettingsGradientPreset[]
user?SettingsGradientPreset[]

Defined in

packages/core/src/react/provider/types.ts:68


SettingsGradientPreset

Ƭ SettingsGradientPreset: Object

Type declaration

NameTypeDescription
gradientstringCSS gradient string.
namestringName of the gradient preset, translatable.
slugstringKebab-case unique identifier for the gradient preset.

Defined in

packages/core/src/react/provider/types.ts:53


SettingsPropertiesComplete

Ƭ SettingsPropertiesComplete: SettingsProperties & { border?: SettingsProperties["border"] ; color?: SettingsProperties["color"] ; custom?: SettingsProperties["custom"] ; layout?: SettingsProperties["layout"] ; spacing?: SettingsProperties["spacing"] ; typography?: SettingsProperties["typography"] }

Defined in

packages/core/src/react/provider/types.ts:10


Spacing

Ƭ Spacing: Object

Type declaration

NameType
blockGapstring
margin{ bottom: string ; left: string ; right: string ; top: string }
margin.bottomstring
margin.leftstring
margin.rightstring
margin.topstring
padding{ bottom: string ; left: string ; right: string ; top: string }
padding.bottomstring
padding.leftstring
padding.rightstring
padding.topstring
supportsBlockGapboolean
supportsMarginboolean
supportsPaddingboolean

Defined in

packages/core/src/react/blocks/types.ts:40


Style

Ƭ Style: Object

Type declaration

NameType
borderBorder
spacingSpacing
typographyTypography

Defined in

packages/core/src/react/blocks/types.ts:17


StylesPropertiesAndElementsComplete

Ƭ StylesPropertiesAndElementsComplete: StylesProperties & { border?: SettingsProperties["border"] ; color?: SettingsProperties["color"] ; elements?: StylesElementsPropertiesComplete ; spacing?: SettingsProperties["spacing"] ; typography?: SettingsProperties["typography"] }

Defined in

packages/core/src/react/provider/types.ts:24


StylesPropertiesComplete

Ƭ StylesPropertiesComplete: StylesProperties & { border?: SettingsProperties["border"] ; color?: SettingsProperties["color"] ; spacing?: SettingsProperties["spacing"] ; typography?: SettingsProperties["typography"] }

Defined in

packages/core/src/react/provider/types.ts:18


ThemeJSON

Ƭ ThemeJSON: Pick<WpThemeJSON, "styles" | "settings">

Defined in

packages/core/src/react/provider/types.ts:352


SettingsContext

Const SettingsContext: Context<Partial<SettingsContextProps>>

Defined in

packages/core/src/react/provider/Provider.tsx:5


ThemeSettingsContext

Const ThemeSettingsContext: Context<ThemeJSON>

Defined in

packages/core/src/react/provider/ThemeSettingsProvider.tsx:4


defaultElement

Const defaultElement: Element

Defined in

packages/core/src/react/blocks/hooks/useBlock.ts:8


ColumnBlock

ColumnBlock(«destructured»): Element

Parameters

NameType
«destructured»IColumnBlock

Returns

Element

Defined in

packages/core/src/react/blocks/ColumnBlock.tsx:11


ColumnsBlock

ColumnsBlock(«destructured»): Element

Parameters

NameType
«destructured»IColumnsBlock

Returns

Element

Defined in

packages/core/src/react/blocks/ColumnsBlocks.tsx:11


CoverBlock

CoverBlock(«destructured»): Element

Parameters

NameType
«destructured»ICoverBlock

Returns

Element

Defined in

packages/core/src/react/blocks/CoverBlock.tsx:24


DataFetchingProvider

DataFetchingProvider(props, context?): null | ReactElement<any, any>

Parameters

NameType
propsPropsWithChildren<DataFetchingProviderProps>
context?any

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:542


DebugBlock

DebugBlock(«destructured»): Element

Parameters

NameType
«destructured»Object

Returns

Element

Defined in

packages/core/src/react/blocks/DebugBlock.tsx:7


FileBlock

FileBlock(«destructured»): Element

Parameters

NameType
«destructured»IFileBlock

Returns

Element

Defined in

packages/core/src/react/blocks/FileBlock.tsx:14


GroupBlock

GroupBlock(«destructured»): Element

Parameters

NameType
«destructured»IGroupBlock

Returns

Element

Defined in

packages/core/src/react/blocks/GroupBlock.tsx:17


HeadingBlock

HeadingBlock(«destructured»): Element

Parameters

NameType
«destructured»IHeadingBlock

Returns

Element

Defined in

packages/core/src/react/blocks/HeadingBlock.tsx:12


ImageBlock

ImageBlock(«destructured»): Element

Parameters

NameType
«destructured»IImageBlock

Returns

Element

Defined in

packages/core/src/react/blocks/ImageBlock.tsx:19


ListBlock

ListBlock(«destructured»): Element

Parameters

NameType
«destructured»IListBlock

Returns

Element

Defined in

packages/core/src/react/blocks/ListBlock.tsx:12


MediaTextBlock

MediaTextBlock(«destructured»): Element

Parameters

NameType
«destructured»IMediaTextBlock

Returns

Element

Defined in

packages/core/src/react/blocks/MediaTextBlock.tsx:22


Menu(«destructured»): Element

Parameters

NameType
«destructured»MenuProps

Returns

Element

Defined in

packages/core/src/react/components/Menu.tsx:109


MenuItems(«destructured»): Element

Parameters

NameType
«destructured»MenuItemsProp

Returns

Element

Defined in

packages/core/src/react/components/Menu.tsx:54


ParagraphBlock

ParagraphBlock(«destructured»): Element

Parameters

NameType
«destructured»IParagraphBlock

Returns

Element

Defined in

packages/core/src/react/blocks/ParagraphBlock.tsx:13


PreformattedBlock

PreformattedBlock(«destructured»): Element

Parameters

NameType
«destructured»IPreformattedBlock

Returns

Element

Defined in

packages/core/src/react/blocks/PreformatedBlock.tsx:11


PullQuoteBlock

PullQuoteBlock(«destructured»): Element

Parameters

NameType
«destructured»IPullQuoteBlock

Returns

Element

Defined in

packages/core/src/react/blocks/PullQuote.tsx:15


QuoteBlock

QuoteBlock(«destructured»): Element

Parameters

NameType
«destructured»IQuoteBlock

Returns

Element

Defined in

packages/core/src/react/blocks/QuoteBlock.tsx:10


SeparatorBlock

SeparatorBlock(«destructured»): Element

Parameters

NameType
«destructured»ISeparatorBlock

Returns

Element

Defined in

packages/core/src/react/blocks/SeparatorBlock.tsx:10


SettingsProvider

SettingsProvider(props, context?): null | ReactElement<any, any>

Parameters

NameType
propsPropsWithChildren<ProviderProps>
context?any

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:542


SpacerBlock

SpacerBlock(«destructured»): Element

Parameters

NameType
«destructured»ISpacerBlock

Returns

Element

Defined in

packages/core/src/react/blocks/SpacerBlock.tsx:12


TableBlock

TableBlock(«destructured»): Element

Parameters

NameType
«destructured»ITableBlock

Returns

Element

Defined in

packages/core/src/react/blocks/TableBlock.tsx:12


ThemeSettingsProvider

ThemeSettingsProvider(props, context?): null | ReactElement<any, any>

Parameters

NameType
propsPropsWithChildren<ProviderProps>
context?any

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:542


VerseBlock

VerseBlock(«destructured»): Element

Parameters

NameType
«destructured»IVerseBlock

Returns

Element

Defined in

packages/core/src/react/blocks/VerseBlock.tsx:11


YoutubeLiteBlock

YoutubeLiteBlock(props): Element

Renders Youtube embeds with lite-youtube-embed

Parameters

NameTypeDescription
propsOmit<IYoutubeLiteBlock, "component">The Block props

Returns

Element

Defined in

packages/core/src/react/blocks/YoutubeLiteBlock.tsx:42


getAlignStyle

getAlignStyle(domNode): "none" | "left" | "center" | "right" | "wide" | "full"

Parameters

NameType
domNodeElement

Returns

"none" | "left" | "center" | "right" | "wide" | "full"

Defined in

packages/core/src/react/blocks/utils.ts:5


getBlockStyle

getBlockStyle(domNode): string

Returns the block style (is-style-{block-style})

Parameters

NameTypeDescription
domNodeElementDomNode

Returns

string

string with block style

Defined in

packages/core/src/react/blocks/utils.ts:39


getColorStyles

getColorStyles(domNode): Colors

Infer GB color styles from classnames

Parameters

NameTypeDescription
domNodeElementDomNode

Returns

Colors

ColorBlockProps object

Defined in

packages/core/src/react/blocks/utils.ts:62


getInlineStyles

getInlineStyles(domNode): false | Record<string, string>

Converts inline styles to a stylesObject for use in react components

Parameters

NameTypeDescription
domNodeElementDomNode

Returns

false | Record<string, string>

Defined in

packages/core/src/react/blocks/utils.ts:120


getTypographyStyles

getTypographyStyles(domNode): Object

Returns the typography styles of a block

Parameters

NameTypeDescription
domNodeElementDomNode

Returns

Object

NameType
fontSizestring
style{ fontSize: string = ''; lineHeight: string = '' }
style.fontSizestring
style.lineHeightstring

Defined in

packages/core/src/react/blocks/utils.ts:177


getWidthStyles

getWidthStyles(domNode): undefined | string

Returns the width size of a block

Parameters

NameTypeDescription
domNodeElementDomNode

Returns

undefined | string

Defined in

packages/core/src/react/blocks/utils.ts:149


parseSeo

parseSeo(seo, options?): string | Element | Element[]

Parameters

NameType
seostring
optionsHTMLReactParserOptions

Returns

string | Element | Element[]

Defined in

packages/core/src/react/utils/parseSeo.ts:4


safeArraySpread

safeArraySpread(array): any[]

Parameters

NameType
arrayany

Returns

any[]

Defined in

packages/core/src/react/blocks/utils.ts:220


serializeKey

serializeKey(key): string

Parameters

NameType
keyKey

Returns

string

Defined in

node_modules/swr/core/dist/index.d.ts:17


useBlock

useBlock<T>(node?): Object

Returns the block name and attributes

Type parameters

NameType
Textends IBlockAttributes

Parameters

NameTypeDescription
node?ElementDomNode

Returns

Object

NameType
attributesT
classNamestring
namestring

Defined in

packages/core/src/react/blocks/hooks/useBlock.ts:38


useBlockAlign

useBlockAlign(node): Align

Returns the block align style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

Align

Defined in

packages/core/src/react/blocks/hooks/useBlockAlign.ts:16


useBlockAttributes

useBlockAttributes(node?): Object

useBlockAttributes hooks returns the block attributes for a given block based on what it supports

Parameters

NameTypeDescription
node?ElementThe reference to the dom node of the block

Returns

Object

NameType
alignAlign
blockStylestring
borderBorder
colorsColors
spacingSpacing
typographyTypography
widthundefined | string

Defined in

packages/core/src/react/blocks/hooks/useBlockAttributes.ts:19


useBlockBorder

useBlockBorder(node): Border

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

Border

Defined in

packages/core/src/react/blocks/hooks/useBlockBorder.ts:17


useBlockColors

useBlockColors(node): Colors

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

Colors

Defined in

packages/core/src/react/blocks/hooks/useBlockColors.ts:25


useBlockSpacing

useBlockSpacing(node): Spacing

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

Spacing

Defined in

packages/core/src/react/blocks/hooks/useBlockSpacing.ts:21


useBlockStyle

useBlockStyle(node): string

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

string

Defined in

packages/core/src/react/blocks/hooks/useBlockStyle.ts:10


useBlockTypography

useBlockTypography(node): Typography

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

Typography

Defined in

packages/core/src/react/blocks/hooks/useBlockTypography.ts:25


useBlockWidth

useBlockWidth(node): undefined | string

Returns the block style (if available)

Parameters

NameTypeDescription
nodeElementDomNode

Returns

undefined | string

Defined in

packages/core/src/react/blocks/hooks/useBlockWidth.ts:16


useFetchAuthorArchive

useFetchAuthorArchive<T, P>(params?, options?, path?): usePostsResponse<T>

The useFetchAuthorArchive hook

See useAuthorArchive

Type parameters

NameType
Textends PostEntity = PostEntity
Pextends PostsArchiveParams = PostsArchiveParams

Parameters

NameTypeDefault valueDescription
params{} | PostEntity{}The list of params to pass to the fetch strategy. It overrides the ones in the URL.
optionsFetchHookOptions<FetchResponse<T[]>>{}The options to pass to the swr hook.
pathstring''The path of the url to get url params from.

Returns

usePostsResponse<T>

Defined in

packages/core/src/react/hooks/useFetchAuthorArchive.ts:22


useFetchPost

useFetchPost<T, P>(params?, options?, path?): usePostResponse<T>

Type parameters

NameType
Textends PostEntity = PostEntity
Pextends PostParams = PostParams

Parameters

NameTypeDefault value
params{} | P{}
optionsFetchHookOptions<FetchResponse<T>>{}
pathstring''

Returns

usePostResponse<T>

Defined in

packages/core/src/react/hooks/useFetchPost.ts:36


useFetchPostOrPosts

useFetchPostOrPosts<T, P>(params?, options?, path?): usePostOrPostResponse<T>

Type parameters

NameType
Textends PostEntity = PostEntity
Pextends PostOrPostsParams = PostOrPostsParams

Parameters

NameTypeDefault value
paramsPartial<P>{}
optionsFetchHookOptions<FetchResponse<PostOrPostsFetchStrategyResult<T>>>{}
pathstring''

Returns

usePostOrPostResponse<T>

Defined in

packages/core/src/react/hooks/useFetchPostOrPosts.ts:32


useSWR

useSWR<Data, Error, SWRKey>(key): SWRResponse<Data, Error, any>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey

Parameters

NameType
keySWRKey

Returns

SWRResponse<Data, Error, any>

Defined in

node_modules/swr/_internal/dist/index.d.ts:200

useSWR<Data, Error, SWRKey>(key, fetcher): SWRResponse<Data, Error, any>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey

Parameters

NameType
keySWRKey
fetchernull | Fetcher<Data, SWRKey>

Returns

SWRResponse<Data, Error, any>

Defined in

node_modules/swr/_internal/dist/index.d.ts:201

useSWR<Data, Error, SWRKey, SWROptions>(key, config): SWRResponse<Data, Error, SWROptions>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>>

Parameters

NameType
keySWRKey
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Defined in

node_modules/swr/_internal/dist/index.d.ts:202

useSWR<Data, Error, SWRKey, SWROptions>(key, fetcher, config): SWRResponse<Data, Error, SWROptions>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>>

Parameters

NameType
keySWRKey
fetchernull | Fetcher<Data, SWRKey>
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Defined in

node_modules/swr/_internal/dist/index.d.ts:203

useSWR<Data, Error>(key): SWRResponse<Data, Error, any>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany

Parameters

NameType
keyKey

Returns

SWRResponse<Data, Error, any>

Defined in

node_modules/swr/_internal/dist/index.d.ts:204

useSWR<Data, Error>(key, fetcher): SWRResponse<Data, Error, any>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany

Parameters

NameType
keyKey
fetchernull | BareFetcher<Data>

Returns

SWRResponse<Data, Error, any>

Defined in

node_modules/swr/_internal/dist/index.d.ts:205

useSWR<Data, Error, SWROptions>(key, config): SWRResponse<Data, Error, SWROptions>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>>

Parameters

NameType
keyKey
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Defined in

node_modules/swr/_internal/dist/index.d.ts:206

useSWR<Data, Error, SWROptions>(key, fetcher, config): SWRResponse<Data, Error, SWROptions>

A hook to fetch data.

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}

Type parameters

NameType
Dataany
Errorany
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>>

Parameters

NameType
keyKey
fetchernull | BareFetcher<Data>
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Defined in

node_modules/swr/_internal/dist/index.d.ts:207


useSWRConfig

useSWRConfig(): FullConfiguration<any, any, BareFetcher<unknown>>

Returns

FullConfiguration<any, any, BareFetcher<unknown>>

Defined in

node_modules/swr/_internal/dist/index.d.ts:336


useSettings

useSettings(): Partial<SettingsContextProps>

Returns

Partial<SettingsContextProps>

Defined in

packages/core/src/react/provider/useSettings.ts:4


useThemeSetting

useThemeSetting(path, blockName?, defaultValue?, fallbackToGlobalSetting?): any

Returns a single theme setting normalized

Parameters

NameTypeDefault valueDescription
pathstringundefinedThe path to the setting
blockNamenull | string''The block name
defaultValueany''the default value to return
fallbackToGlobalSettingbooleantrueWhether it should fallback to global setting if blockName is passed but setting does not exist

Returns

any

Defined in

packages/core/src/react/provider/useThemeSetting.ts:22


useThemeSettings

useThemeSettings(): undefined | SettingsProperties & { blocks?: { core/archives?: SettingsPropertiesComplete ; core/audio?: SettingsPropertiesComplete ; core/block?: SettingsPropertiesComplete ; core/button?: SettingsPropertiesComplete ; core/buttons?: SettingsPropertiesComplete ; core/calendar?: SettingsPropertiesComplete ; core/categories?: SettingsPropertiesComplete ; core/code?: SettingsPropertiesComplete ; core/column?: SettingsPropertiesComplete ; core/columns?: SettingsPropertiesComplete ; core/comment-author-avatar?: SettingsPropertiesComplete ; core/comment-author-name?: SettingsPropertiesComplete ; core/comment-content?: SettingsPropertiesComplete ; core/comment-date?: SettingsPropertiesComplete ; core/comment-edit-link?: SettingsPropertiesComplete ; core/comment-reply-link?: SettingsPropertiesComplete ; core/comment-template?: SettingsPropertiesComplete ; core/comments-query-loop?: SettingsPropertiesComplete ; core/cover?: SettingsPropertiesComplete ; core/embed?: SettingsPropertiesComplete ; core/file?: SettingsPropertiesComplete ; core/freeform?: SettingsPropertiesComplete ; core/gallery?: SettingsPropertiesComplete ; core/group?: SettingsPropertiesComplete ; core/heading?: SettingsPropertiesComplete ; core/home-link?: SettingsPropertiesComplete ; core/html?: SettingsPropertiesComplete ; core/image?: SettingsPropertiesComplete ; core/latest-comments?: SettingsPropertiesComplete ; core/latest-posts?: SettingsPropertiesComplete ; core/legacy-widget?: SettingsPropertiesComplete ; core/list?: SettingsPropertiesComplete ; core/loginout?: SettingsPropertiesComplete ; core/media-text?: SettingsPropertiesComplete ; core/missing?: SettingsPropertiesComplete ; core/more?: SettingsPropertiesComplete ; core/navigation?: SettingsPropertiesComplete ; core/navigation-link?: SettingsPropertiesComplete ; core/nextpage?: SettingsPropertiesComplete ; core/page-list?: SettingsPropertiesComplete ; core/paragraph?: SettingsPropertiesComplete ; core/post-author?: SettingsPropertiesComplete ; core/post-comments?: SettingsPropertiesComplete ; core/post-comments-count?: SettingsPropertiesComplete ; core/post-comments-form?: SettingsPropertiesComplete ; core/post-comments-link?: SettingsPropertiesComplete ; core/post-content?: SettingsPropertiesComplete ; core/post-date?: SettingsPropertiesComplete ; core/post-excerpt?: SettingsPropertiesComplete ; core/post-featured-image?: SettingsPropertiesComplete ; core/post-navigation-link?: SettingsPropertiesComplete ; core/post-template?: SettingsPropertiesComplete ; core/post-terms?: SettingsPropertiesComplete ; core/post-title?: SettingsPropertiesComplete ; core/preformatted?: SettingsPropertiesComplete ; core/pullquote?: SettingsPropertiesComplete ; core/query?: SettingsPropertiesComplete ; core/query-pagination?: SettingsPropertiesComplete ; core/query-pagination-next?: SettingsPropertiesComplete ; core/query-pagination-numbers?: SettingsPropertiesComplete ; core/query-pagination-previous?: SettingsPropertiesComplete ; core/query-title?: SettingsPropertiesComplete ; core/quote?: SettingsPropertiesComplete ; core/rss?: SettingsPropertiesComplete ; core/search?: SettingsPropertiesComplete ; core/separator?: SettingsPropertiesComplete ; core/shortcode?: SettingsPropertiesComplete ; core/site-logo?: SettingsPropertiesComplete ; core/site-tagline?: SettingsPropertiesComplete ; core/site-title?: SettingsPropertiesComplete ; core/social-link?: SettingsPropertiesComplete ; core/social-links?: SettingsPropertiesComplete ; core/spacer?: SettingsPropertiesComplete ; core/table?: SettingsPropertiesComplete ; core/table-of-contents?: SettingsPropertiesComplete ; core/tag-cloud?: SettingsPropertiesComplete ; core/template-part?: SettingsPropertiesComplete ; core/term-description?: SettingsPropertiesComplete ; core/text-columns?: SettingsPropertiesComplete ; core/verse?: SettingsPropertiesComplete ; core/video?: SettingsPropertiesComplete ; core/widget-area?: SettingsPropertiesComplete ; core/widget-group?: SettingsPropertiesComplete } ; border?: { color?: boolean ; radius?: boolean ; style?: boolean ; width?: boolean } ; color?: { background?: boolean ; custom?: boolean ; customDuotone?: boolean ; customGradient?: boolean ; defaultGradients?: boolean ; defaultPalette?: boolean ; duotone?: SettingsDuotone ; gradients?: SettingsGradient ; link?: boolean ; palette?: SettingsColorPalette ; text?: boolean } ; custom?: { [k: string]: string | number | SettingsCustomAdditionalProperties; } ; layout?: { contentSize?: string ; wideSize?: string } ; spacing?: { blockGap?: null | boolean ; margin?: boolean ; padding?: boolean ; units?: string[] } ; typography?: { customFontSize?: boolean ; dropCap?: boolean ; fontFamilies?: { fontFamily?: string ; name?: string ; slug?: string }[] ; fontSizes?: { name?: string ; size?: string ; slug?: string }[] ; fontStyle?: boolean ; fontWeight?: boolean ; letterSpacing?: boolean ; lineHeight?: boolean ; textDecoration?: boolean ; textTransform?: boolean } }

Returns the raw theme.json settings definitions

Returns

undefined | SettingsProperties & { blocks?: { core/archives?: SettingsPropertiesComplete ; core/audio?: SettingsPropertiesComplete ; core/block?: SettingsPropertiesComplete ; core/button?: SettingsPropertiesComplete ; core/buttons?: SettingsPropertiesComplete ; core/calendar?: SettingsPropertiesComplete ; core/categories?: SettingsPropertiesComplete ; core/code?: SettingsPropertiesComplete ; core/column?: SettingsPropertiesComplete ; core/columns?: SettingsPropertiesComplete ; core/comment-author-avatar?: SettingsPropertiesComplete ; core/comment-author-name?: SettingsPropertiesComplete ; core/comment-content?: SettingsPropertiesComplete ; core/comment-date?: SettingsPropertiesComplete ; core/comment-edit-link?: SettingsPropertiesComplete ; core/comment-reply-link?: SettingsPropertiesComplete ; core/comment-template?: SettingsPropertiesComplete ; core/comments-query-loop?: SettingsPropertiesComplete ; core/cover?: SettingsPropertiesComplete ; core/embed?: SettingsPropertiesComplete ; core/file?: SettingsPropertiesComplete ; core/freeform?: SettingsPropertiesComplete ; core/gallery?: SettingsPropertiesComplete ; core/group?: SettingsPropertiesComplete ; core/heading?: SettingsPropertiesComplete ; core/home-link?: SettingsPropertiesComplete ; core/html?: SettingsPropertiesComplete ; core/image?: SettingsPropertiesComplete ; core/latest-comments?: SettingsPropertiesComplete ; core/latest-posts?: SettingsPropertiesComplete ; core/legacy-widget?: SettingsPropertiesComplete ; core/list?: SettingsPropertiesComplete ; core/loginout?: SettingsPropertiesComplete ; core/media-text?: SettingsPropertiesComplete ; core/missing?: SettingsPropertiesComplete ; core/more?: SettingsPropertiesComplete ; core/navigation?: SettingsPropertiesComplete ; core/navigation-link?: SettingsPropertiesComplete ; core/nextpage?: SettingsPropertiesComplete ; core/page-list?: SettingsPropertiesComplete ; core/paragraph?: SettingsPropertiesComplete ; core/post-author?: SettingsPropertiesComplete ; core/post-comments?: SettingsPropertiesComplete ; core/post-comments-count?: SettingsPropertiesComplete ; core/post-comments-form?: SettingsPropertiesComplete ; core/post-comments-link?: SettingsPropertiesComplete ; core/post-content?: SettingsPropertiesComplete ; core/post-date?: SettingsPropertiesComplete ; core/post-excerpt?: SettingsPropertiesComplete ; core/post-featured-image?: SettingsPropertiesComplete ; core/post-navigation-link?: SettingsPropertiesComplete ; core/post-template?: SettingsPropertiesComplete ; core/post-terms?: SettingsPropertiesComplete ; core/post-title?: SettingsPropertiesComplete ; core/preformatted?: SettingsPropertiesComplete ; core/pullquote?: SettingsPropertiesComplete ; core/query?: SettingsPropertiesComplete ; core/query-pagination?: SettingsPropertiesComplete ; core/query-pagination-next?: SettingsPropertiesComplete ; core/query-pagination-numbers?: SettingsPropertiesComplete ; core/query-pagination-previous?: SettingsPropertiesComplete ; core/query-title?: SettingsPropertiesComplete ; core/quote?: SettingsPropertiesComplete ; core/rss?: SettingsPropertiesComplete ; core/search?: SettingsPropertiesComplete ; core/separator?: SettingsPropertiesComplete ; core/shortcode?: SettingsPropertiesComplete ; core/site-logo?: SettingsPropertiesComplete ; core/site-tagline?: SettingsPropertiesComplete ; core/site-title?: SettingsPropertiesComplete ; core/social-link?: SettingsPropertiesComplete ; core/social-links?: SettingsPropertiesComplete ; core/spacer?: SettingsPropertiesComplete ; core/table?: SettingsPropertiesComplete ; core/table-of-contents?: SettingsPropertiesComplete ; core/tag-cloud?: SettingsPropertiesComplete ; core/template-part?: SettingsPropertiesComplete ; core/term-description?: SettingsPropertiesComplete ; core/text-columns?: SettingsPropertiesComplete ; core/verse?: SettingsPropertiesComplete ; core/video?: SettingsPropertiesComplete ; core/widget-area?: SettingsPropertiesComplete ; core/widget-group?: SettingsPropertiesComplete } ; border?: { color?: boolean ; radius?: boolean ; style?: boolean ; width?: boolean } ; color?: { background?: boolean ; custom?: boolean ; customDuotone?: boolean ; customGradient?: boolean ; defaultGradients?: boolean ; defaultPalette?: boolean ; duotone?: SettingsDuotone ; gradients?: SettingsGradient ; link?: boolean ; palette?: SettingsColorPalette ; text?: boolean } ; custom?: { [k: string]: string | number | SettingsCustomAdditionalProperties; } ; layout?: { contentSize?: string ; wideSize?: string } ; spacing?: { blockGap?: null | boolean ; margin?: boolean ; padding?: boolean ; units?: string[] } ; typography?: { customFontSize?: boolean ; dropCap?: boolean ; fontFamilies?: { fontFamily?: string ; name?: string ; slug?: string }[] ; fontSizes?: { name?: string ; size?: string ; slug?: string }[] ; fontStyle?: boolean ; fontWeight?: boolean ; letterSpacing?: boolean ; lineHeight?: boolean ; textDecoration?: boolean ; textTransform?: boolean } }

Defined in

packages/core/src/react/provider/useThemeSettings.ts:9


useThemeStyles

useThemeStyles(): undefined | StylesProperties & { blocks?: { core/archives?: StylesPropertiesAndElementsComplete ; core/audio?: StylesPropertiesAndElementsComplete ; core/block?: StylesPropertiesAndElementsComplete ; core/button?: StylesPropertiesAndElementsComplete ; core/buttons?: StylesPropertiesAndElementsComplete ; core/calendar?: StylesPropertiesAndElementsComplete ; core/categories?: StylesPropertiesAndElementsComplete ; core/code?: StylesPropertiesAndElementsComplete ; core/column?: StylesPropertiesAndElementsComplete ; core/columns?: StylesPropertiesAndElementsComplete ; core/comment-author-avatar?: StylesPropertiesAndElementsComplete ; core/comment-author-name?: StylesPropertiesAndElementsComplete ; core/comment-content?: StylesPropertiesAndElementsComplete ; core/comment-date?: StylesPropertiesAndElementsComplete ; core/comment-edit-link?: StylesPropertiesAndElementsComplete ; core/comment-reply-link?: StylesPropertiesAndElementsComplete ; core/comment-template?: StylesPropertiesAndElementsComplete ; core/comments-query-loop?: StylesPropertiesAndElementsComplete ; core/cover?: StylesPropertiesAndElementsComplete ; core/embed?: StylesPropertiesAndElementsComplete ; core/file?: StylesPropertiesAndElementsComplete ; core/freeform?: StylesPropertiesAndElementsComplete ; core/gallery?: StylesPropertiesAndElementsComplete ; core/group?: StylesPropertiesAndElementsComplete ; core/heading?: StylesPropertiesAndElementsComplete ; core/home-link?: StylesPropertiesAndElementsComplete ; core/html?: StylesPropertiesAndElementsComplete ; core/image?: StylesPropertiesAndElementsComplete ; core/latest-comments?: StylesPropertiesAndElementsComplete ; core/latest-posts?: StylesPropertiesAndElementsComplete ; core/legacy-widget?: StylesPropertiesAndElementsComplete ; core/list?: StylesPropertiesAndElementsComplete ; core/loginout?: StylesPropertiesAndElementsComplete ; core/media-text?: StylesPropertiesAndElementsComplete ; core/missing?: StylesPropertiesAndElementsComplete ; core/more?: StylesPropertiesAndElementsComplete ; core/navigation?: StylesPropertiesAndElementsComplete ; core/navigation-link?: StylesPropertiesAndElementsComplete ; core/nextpage?: StylesPropertiesAndElementsComplete ; core/page-list?: StylesPropertiesAndElementsComplete ; core/paragraph?: StylesPropertiesAndElementsComplete ; core/post-author?: StylesPropertiesAndElementsComplete ; core/post-comments?: StylesPropertiesAndElementsComplete ; core/post-comments-count?: StylesPropertiesAndElementsComplete ; core/post-comments-form?: StylesPropertiesAndElementsComplete ; core/post-comments-link?: StylesPropertiesAndElementsComplete ; core/post-content?: StylesPropertiesAndElementsComplete ; core/post-date?: StylesPropertiesAndElementsComplete ; core/post-excerpt?: StylesPropertiesAndElementsComplete ; core/post-featured-image?: StylesPropertiesAndElementsComplete ; core/post-navigation-link?: StylesPropertiesAndElementsComplete ; core/post-template?: StylesPropertiesAndElementsComplete ; core/post-terms?: StylesPropertiesAndElementsComplete ; core/post-title?: StylesPropertiesAndElementsComplete ; core/preformatted?: StylesPropertiesAndElementsComplete ; core/pullquote?: StylesPropertiesAndElementsComplete ; core/query?: StylesPropertiesAndElementsComplete ; core/query-pagination?: StylesPropertiesAndElementsComplete ; core/query-pagination-next?: StylesPropertiesAndElementsComplete ; core/query-pagination-numbers?: StylesPropertiesAndElementsComplete ; core/query-pagination-previous?: StylesPropertiesAndElementsComplete ; core/query-title?: StylesPropertiesAndElementsComplete ; core/quote?: StylesPropertiesAndElementsComplete ; core/rss?: StylesPropertiesAndElementsComplete ; core/search?: StylesPropertiesAndElementsComplete ; core/separator?: StylesPropertiesAndElementsComplete ; core/shortcode?: StylesPropertiesAndElementsComplete ; core/site-logo?: StylesPropertiesAndElementsComplete ; core/site-tagline?: StylesPropertiesAndElementsComplete ; core/site-title?: StylesPropertiesAndElementsComplete ; core/social-link?: StylesPropertiesAndElementsComplete ; core/social-links?: StylesPropertiesAndElementsComplete ; core/spacer?: StylesPropertiesAndElementsComplete ; core/table?: StylesPropertiesAndElementsComplete ; core/table-of-contents?: StylesPropertiesAndElementsComplete ; core/tag-cloud?: StylesPropertiesAndElementsComplete ; core/template-part?: StylesPropertiesAndElementsComplete ; core/term-description?: StylesPropertiesAndElementsComplete ; core/text-columns?: StylesPropertiesAndElementsComplete ; core/verse?: StylesPropertiesAndElementsComplete ; core/video?: StylesPropertiesAndElementsComplete ; core/widget-area?: StylesPropertiesAndElementsComplete ; core/widget-group?: StylesPropertiesAndElementsComplete } ; border?: unknown ; color?: unknown ; elements?: { h1?: StylesPropertiesComplete ; h2?: StylesPropertiesComplete ; h3?: StylesPropertiesComplete ; h4?: StylesPropertiesComplete ; h5?: StylesPropertiesComplete ; h6?: StylesPropertiesComplete ; link?: StylesPropertiesComplete } ; spacing?: unknown ; typography?: unknown }

Returns the theme.json styles definitions

Returns

undefined | StylesProperties & { blocks?: { core/archives?: StylesPropertiesAndElementsComplete ; core/audio?: StylesPropertiesAndElementsComplete ; core/block?: StylesPropertiesAndElementsComplete ; core/button?: StylesPropertiesAndElementsComplete ; core/buttons?: StylesPropertiesAndElementsComplete ; core/calendar?: StylesPropertiesAndElementsComplete ; core/categories?: StylesPropertiesAndElementsComplete ; core/code?: StylesPropertiesAndElementsComplete ; core/column?: StylesPropertiesAndElementsComplete ; core/columns?: StylesPropertiesAndElementsComplete ; core/comment-author-avatar?: StylesPropertiesAndElementsComplete ; core/comment-author-name?: StylesPropertiesAndElementsComplete ; core/comment-content?: StylesPropertiesAndElementsComplete ; core/comment-date?: StylesPropertiesAndElementsComplete ; core/comment-edit-link?: StylesPropertiesAndElementsComplete ; core/comment-reply-link?: StylesPropertiesAndElementsComplete ; core/comment-template?: StylesPropertiesAndElementsComplete ; core/comments-query-loop?: StylesPropertiesAndElementsComplete ; core/cover?: StylesPropertiesAndElementsComplete ; core/embed?: StylesPropertiesAndElementsComplete ; core/file?: StylesPropertiesAndElementsComplete ; core/freeform?: StylesPropertiesAndElementsComplete ; core/gallery?: StylesPropertiesAndElementsComplete ; core/group?: StylesPropertiesAndElementsComplete ; core/heading?: StylesPropertiesAndElementsComplete ; core/home-link?: StylesPropertiesAndElementsComplete ; core/html?: StylesPropertiesAndElementsComplete ; core/image?: StylesPropertiesAndElementsComplete ; core/latest-comments?: StylesPropertiesAndElementsComplete ; core/latest-posts?: StylesPropertiesAndElementsComplete ; core/legacy-widget?: StylesPropertiesAndElementsComplete ; core/list?: StylesPropertiesAndElementsComplete ; core/loginout?: StylesPropertiesAndElementsComplete ; core/media-text?: StylesPropertiesAndElementsComplete ; core/missing?: StylesPropertiesAndElementsComplete ; core/more?: StylesPropertiesAndElementsComplete ; core/navigation?: StylesPropertiesAndElementsComplete ; core/navigation-link?: StylesPropertiesAndElementsComplete ; core/nextpage?: StylesPropertiesAndElementsComplete ; core/page-list?: StylesPropertiesAndElementsComplete ; core/paragraph?: StylesPropertiesAndElementsComplete ; core/post-author?: StylesPropertiesAndElementsComplete ; core/post-comments?: StylesPropertiesAndElementsComplete ; core/post-comments-count?: StylesPropertiesAndElementsComplete ; core/post-comments-form?: StylesPropertiesAndElementsComplete ; core/post-comments-link?: StylesPropertiesAndElementsComplete ; core/post-content?: StylesPropertiesAndElementsComplete ; core/post-date?: StylesPropertiesAndElementsComplete ; core/post-excerpt?: StylesPropertiesAndElementsComplete ; core/post-featured-image?: StylesPropertiesAndElementsComplete ; core/post-navigation-link?: StylesPropertiesAndElementsComplete ; core/post-template?: StylesPropertiesAndElementsComplete ; core/post-terms?: StylesPropertiesAndElementsComplete ; core/post-title?: StylesPropertiesAndElementsComplete ; core/preformatted?: StylesPropertiesAndElementsComplete ; core/pullquote?: StylesPropertiesAndElementsComplete ; core/query?: StylesPropertiesAndElementsComplete ; core/query-pagination?: StylesPropertiesAndElementsComplete ; core/query-pagination-next?: StylesPropertiesAndElementsComplete ; core/query-pagination-numbers?: StylesPropertiesAndElementsComplete ; core/query-pagination-previous?: StylesPropertiesAndElementsComplete ; core/query-title?: StylesPropertiesAndElementsComplete ; core/quote?: StylesPropertiesAndElementsComplete ; core/rss?: StylesPropertiesAndElementsComplete ; core/search?: StylesPropertiesAndElementsComplete ; core/separator?: StylesPropertiesAndElementsComplete ; core/shortcode?: StylesPropertiesAndElementsComplete ; core/site-logo?: StylesPropertiesAndElementsComplete ; core/site-tagline?: StylesPropertiesAndElementsComplete ; core/site-title?: StylesPropertiesAndElementsComplete ; core/social-link?: StylesPropertiesAndElementsComplete ; core/social-links?: StylesPropertiesAndElementsComplete ; core/spacer?: StylesPropertiesAndElementsComplete ; core/table?: StylesPropertiesAndElementsComplete ; core/table-of-contents?: StylesPropertiesAndElementsComplete ; core/tag-cloud?: StylesPropertiesAndElementsComplete ; core/template-part?: StylesPropertiesAndElementsComplete ; core/term-description?: StylesPropertiesAndElementsComplete ; core/text-columns?: StylesPropertiesAndElementsComplete ; core/verse?: StylesPropertiesAndElementsComplete ; core/video?: StylesPropertiesAndElementsComplete ; core/widget-area?: StylesPropertiesAndElementsComplete ; core/widget-group?: StylesPropertiesAndElementsComplete } ; border?: unknown ; color?: unknown ; elements?: { h1?: StylesPropertiesComplete ; h2?: StylesPropertiesComplete ; h3?: StylesPropertiesComplete ; h4?: StylesPropertiesComplete ; h5?: StylesPropertiesComplete ; h6?: StylesPropertiesComplete ; link?: StylesPropertiesComplete } ; spacing?: unknown ; typography?: unknown }

Defined in

packages/core/src/react/provider/useThemeStyles.ts:9

React Components

BlocksRenderer

BlocksRenderer(props): Element

The BlocksRenderer components provides an easy way to convert HTML markup into corresponding React components.

The BlocksRenderer component takes in arbitrary html markup and receives a list of react components as children that allows replacing dom nodes with React Components.

The html prop is sanitized through wpKsesPost so it's safe for rendering arbitrary html markup.

The children components must implement the BlockProps interface

Usage

Usage with the test function
<BlocksRenderer html={html}>
<MyLinkBlock test={(node) => isAnchorTag(node, { isInternalLink: true })} />
</BlocksRenderer>
Usage with classList and tagName props
<BlocksRenderer html={html}>
<MyLinkBlock tagName="a" classList="my-special-anchor" />
</BlocksRenderer>

Parameters

NameTypeDescription
propsBlockRendererPropsComponent properties

Returns

Element

Defined in

packages/core/src/react/components/BlocksRenderer.tsx:168


HtmlDecoder

HtmlDecoder(props, context?): null | ReactElement<any, any>

The HtmlDecoder simply decodes html entities

Any actual html markup gets stripped before decoding html entities. If you need to render HTML use SafeHtml

Usage

<HtmlDecoder html="Hello world! &#8211; foo bar &#8211;" />

Parameters

NameTypeDescription
propsPropsWithChildren<HtmlDecodeProps>Component properties
context?any-

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:542


SafeHtml

SafeHtml(props, context?): null | ReactElement<any, any>

The SafeHtml component provides an easy way to safely render HTML

The html prop is sanitized through wpKsesPost so it's safe for rendering arbitrary html markup.

Usage

<SafeHtml html="<div><p>hello world</p> div content</div>" />

Parameters

NameTypeDescription
propsPropsWithChildren<SafeHtmlProps>Component properties
context?any-

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:542