@datadog/apps-frontend
v0.0.10
Published
React inputs for Datadog Apps
Readme
@datadog/apps-frontend
Frontend capabilities for Datadog Apps.
npm install @datadog/apps-frontendThe package root exposes nothing: React capabilities live in this package's subpath entries.
@datadog/apps-frontend/embedding/react—DatadogAppProviderconnects an app to its host, installs this package's default modules, and shares one embedding connection with every module hook beneath it;useDatadogAppEmbeddingreads that connection's state.@datadog/apps-frontend/inputs/react—useDatadogAppInputreads a typed input the host provides.@datadog/apps-frontend/inputs/schema— the input schemas themselves, such asdatadogThemeanddatadogDashboard, passed touseDatadogAppInput.
Usage
Mount the provider near your app root; it installs this package's default modules and shares one embedding connection with every module hook beneath it:
import { DatadogAppProvider } from '@datadog/apps-frontend/embedding/react';
export function App() {
return <DatadogAppProvider>{/* app UI */}</DatadogAppProvider>;
}Additional modules are installed by passing them in modules. A module is a
startup capability, not a UI layer: on mount the provider runs each one's
install with the shared connection and a dispose signal, and the app's UI
renders untouched:
<DatadogAppProvider modules={[someModule({ option: true })]}>
{/* app UI */}
</DatadogAppProvider>disabledModules accepts exactly the ids of this package's default modules —
type-checked and autocompleted from the default set, so a misspelled id is a
compile error. Deep links ('datadog.deep-links') is installed by default and
can be excluded when an app must opt out. At runtime an unknown id only warns,
so a frozen app compiled against an older default set keeps rendering.
React 18 and 19 are supported as peer dependencies; @datadog/druids is an
optional peer, needed only by the druids/react entry.
Development
cd packages/published/apps-frontend
yarn build
yarn -T typecheck:workspace
yarn -T test-unit:workspaceAuthoring Inputs schemas
Write one schema factory with its fields and publication policy, then register
that factory in src/inputs/schemas/. The module owns schema
registration, tooling, and generated host/consumer views. Public imports stay
inputs/schema; web-ui hosts use inputs/internal.
License
Apache-2.0
