Skip to main content

Hooks

Hooks for reading schemas, running actions and driving UI state. Use them when you build a custom component that has to behave like the generated ones — inside the generated views the same data is already in context.

Data and actions​

HookWhat it gives you
useGetLocalResourceSchemaA resource's full schema plus flags for the views, actions and endpoints it exposes
useSchemaProviderThe schema provider in context; a type argument adds an extension package's methods as optional — see SchemaProvider
useGetAllEvery record of a resource, paginated behind the scenes
useCallActionRuns a backend action, including polling for background tasks
useAggregateAn aggregation over a resource, and the schema saying what may be aggregated — ships in habarico-enterprise
useUploadQueueThe upload queue behind UploadInput — base64 and chunked
useSubmitFormSubmit handling for a hand-built form: notifications, field errors, loading state
useRemoveArrayItemRow removal for a hand-built array editor, without the deleted row's values leaking onto its neighbour

Schemas and context​

HookWhat it gives you
Schema lookup hooksuseGetGlobalResourceSchema, useGlobalResourceSchemaContext, useGetServiceSchemas, useLocalResourceSchemaRefresh
Context hooksuseSchemaRootContext, useAdminConfig, useIcons, useViewSchemaContext, useFieldSchemaContext, useRootRecordContext, useFormInputSourcesContext, useFormInputSourcesRegistration, useUnsavedChanges, useUnsavedChangesControl, useGetTargetValues
useSchemaValidatorsThe validators for a field's schema rules, for an input you wrote yourself

UI state​

HookWhat it gives you
useTabsLocationActive tab state kept in the URL hash
useRowClickSingle- and double-click activation for datagrid rows
useRecordLinkOpens a record as a page, a dialog or a docked panel — the link behind every record chip
useExporterRuns a backend export and downloads the returned file
useStrTemplateInterpolates %{record.field} templates from the current record or form
Dashboard hooksuseDashboardStore and useGetWidget, both from habarico-enterprise

Thin wrappers​

useRouter and usePathname wrap react-router with no Habarico behaviour of their own — useRouter returns {back, forward, refresh, push, replace} and usePathname returns the current path. Use them for consistency with the library's own components, or use react-router directly; there is no difference.

See also​