Runtime API
SolidBase provides multiple primitives for accessing runtime data. These are the same primitives used to build the default theme.
Route Data
useSolidBaseContext
Provides access to the SolidBase config, locale, and page title.
The config will have the locale's themeConfig
spread onto its own themeConfig
.
useCurrentPageData
Provides access to the data for the current page,
including frontmatter, table of contents, and lastUpdated
.
Theme
getTheme
Returns the current theme as determined by the theme cookie and system preferences.
setTheme
Updates the current theme.
getThemVariant
Similar to getTheme
, but indicates whether the theme is being derived from system preferences.
This is intended to be used in theme switchers.
Locale
useLocale
Allows reading and updating the current locale, and provides utilities for managing paths that don't include the locale.
getLocale
Returns the locale for the provided or path.
If path
is not provided then on the server the request pathname
will be used,
and on the client location.pathname
will be used.
This is mostly intended for getHtmlProps
.
getLocaleLink
Returns the root path for the provided locale.
Last updated: 11/15/24, 4:58 AM