@nozzleio/react-mosaic
v0.1.1
Published
React bindings for Mosaic coordinators and selections.
Readme
@nozzleio/react-mosaic
React bindings for Mosaic coordinators, connector lifecycle, and selections.
This package owns the shared React context used by the Mosaic adapters. Use it to create or switch coordinators, create stable selections, observe selection values, and register selections for reset flows.
Install
npm install @nozzleio/react-mosaic reactWhat lives here
MosaicContext,useCoordinator,useOptionalCoordinatorMosaicConnectorProvider,useConnectorStatus,useMosaicCoordinatoruseRequireModeuseMosaicSelection,useMosaicSelections,useCascadingContextsuseMosaicSelectionValue,useSelectionListenerSelectionRegistryProvider,useSelectionRegistry,useRegisterSelectionsuseMosaicClientHttpArrowConnector
import {
MosaicConnectorProvider,
useConnectorStatus,
useMosaicSelection,
useRequireMode,
} from '@nozzleio/react-mosaic';
function RemoteView() {
const ready = useRequireMode('remote');
const { status } = useConnectorStatus();
const selection = useMosaicSelection();
if (!ready || status !== 'connected') {
return null;
}
return <button onClick={() => selection.reset()}>Reset selection</button>;
}
function App() {
return (
<MosaicConnectorProvider initialMode="wasm">
<RemoteView />
</MosaicConnectorProvider>
);
}Notes
useRequireMode()returns a boolean readiness signal. Components that query immediately should still guard on that result before using coordinator-dependent clients.HttpArrowConnectoris exported from the package root for now even though it is not itself a React hook.- Table-specific active-filter helpers do not live here. Import
MosaicFilterProvider,useFilterRegistry,useActiveFilters, anduseRegisterFilterSourcefrom@nozzleio/mosaic-tanstack-react-table.
