KivaDataExportMenu
Toolbar export button that opens an action sheet (visible columns, all columns, or a column picker with Name / ID / Autonumber ID variants for relation, user and choice fields) and reports the selection for a server-side Kiva export. API-aligned with the web KivaDataExportMenu.
Installation
pnpm dlx @kivacore/ui-cli add @kivacore/rn-kiva-data-export-menupnpm add tailwind-variantsThe menu only reports what the user picked. It does not call the API. Wire onExport to useKivaDataExport, which POSTs to /v1/edge/run/query-export, writes the returned file into the cache directory and opens the share sheet. That hook uses the optional expo-file-system and expo-sharing peers.
Usage
import { useKivaClient } from '@kivacore/signin/react-native';
import {
KivaDataExportMenu,
encodeKivaDataExportColumn,
type KivaDataExportSelection
} from '@/components/kiva-native/kiva-data-export-menu';
import { useKivaDataExport } from '@/hooks/kiva-native/use-kiva-data-export';
export function ExportButton({ dataSourceId, fields, visibleSlugs, query }: Props) {
const client = useKivaClient();
const { exportData, isExporting } = useKivaDataExport({ client: client!, fileName: 'contacts' });
const handleExport = async (selection: KivaDataExportSelection) => {
const columns = selection.scope === 'all'
? '*'
: selection.scope === 'visible'
? visibleSlugs
: selection.columns.map(encodeKivaDataExportColumn);
await exportData({ dataSourceId, columns, filters: query });
};
return (
<KivaDataExportMenu
onExport={handleExport}
fields={fields.map(field => ({ slug: field.slug, name: field.name, type: field.type }))}
visibleSlugs={visibleSlugs}
isExporting={isExporting} />
);
}Behaviour
- The trigger is an outline icon button (
fal download) that shows a spinner whileisExportingis set. - Pressing it opens an
ActionSheettitled Export to Excel with Export visible columns, Export all columns and, whenfieldsis non-empty, Select columns…. - Select columns… opens a large-detent sheet with a description, a search input, Select all / Clear all for the filtered list, and one checkbox row per field (name + slug). Relation, user and choice fields get a
ToggleGroupwith Name, ID and, for relation fields only, Autonumber ID. The header has Cancel and Export. The sheet re-seeds its selection every time it opens:visibleSlugsstart checked (all fields when omitted), and variant fields start on['name']. encodeKivaDataExportColumnturns{ slug: 'country', variants: ['name', 'id'] }intocountry(id,name). Variants are always emitted inid,name,autonumber_idorder.
API Reference
KivaDataExportMenuProps
| Prop | Type | Default | Description |
|---|---|---|---|
onExport | (selection: KivaDataExportSelection) => void | Promise<void> | — | Called with the picked entry. Should start the server export (required). |
fields | ReadonlyArray<KivaDataExportFieldOption> | — | Exportable fields. When set, the Select columns… entry appears. |
visibleSlugs | ReadonlyArray<string> | every field | Slugs checked when the column sheet opens. |
isExporting | boolean | false | Show a spinner on the trigger and disable interactions. |
disabled | boolean | false | Disable the trigger (for example while the data source loads). |
className | string | — | Extra classes for the trigger button. |
KivaDataExportSelection
| Variant | Description |
|---|---|
{ scope: 'visible' } | Export the columns currently visible in your list. |
{ scope: 'all' } | Export every exportable field (columns: '*'). |
{ scope: 'custom'; columns: ReadonlyArray<KivaDataExportColumn> } | The columns picked in the sheet. |
KivaDataExportColumn
| Field | Type | Description |
|---|---|---|
slug | string | Field slug. |
variants | ReadonlyArray<KivaDataExportColumnVariant> | 'name' | 'id' | 'autonumber_id'. Empty keeps the server default. |
KivaDataExportFieldOption
| Field | Type | Description |
|---|---|---|
slug | string | Field slug. |
name | string | Display name. |
type | string | Field type (field-relation, field-userSelect, field-select, …). Decides which variants are offered. |
Variant fields: relation (field-relation, field-relatedField), user (field-userSelect, field-userMultiSelect) and choice (field-select, field-multiSelect, field-radioGroup, field-tagSelect, field-status, field-approvalStatus, field-enum, field-systemEnum).
Native differences
- The dropdown menu is an
ActionSheet, and the column dialog is a large-detent sheet with Cancel / Export in the header. - The column sheet opens after the menu sheet has dismissed (a short delay avoids stacking two iOS modals).
- The export file is not downloaded by the browser.
useKivaDataExportwrites it withexpo-file-systemand shares it withexpo-sharing(shared helpers in the internallib/native-export).
Translation keys
ui.dataGrid.export, exportLabel, exportVisibleColumns, exportAllColumns, exportSelectColumns, exportSelectColumnsTitle, exportSelectColumnsDescription, exportSelectedSuffix, exportSearchColumns, exportSelectAll, exportClearAll, exportNoColumns, exportVariantName, exportVariantId, exportVariantAutonumber, exportSubmit, exportCancel (shared with web).
Components
| Component | Description |
|---|---|
KivaDataExportMenu | Trigger + action sheet + column picker sheet. |
Helpers
| Export | Description |
|---|---|
encodeKivaDataExportColumn(column) | Encodes a column entry as slug or slug(v1,v2). |
Type Exports
| Type | Description |
|---|---|
KivaDataExportMenuProps | Component props. |
KivaDataExportSelection | Picked entry. |
KivaDataExportScope | 'visible' | 'all' | 'custom'. |
KivaDataExportColumn | A custom column entry. |
KivaDataExportColumnVariant | 'name' | 'id' | 'autonumber_id'. |
KivaDataExportFieldOption | { slug, name, type }. |
KivaAgent
Mobile AI assistant chat for Kiva agents — streamed markdown, reasoning, tool calls, adaptive cards, sources and attachments, a composer with feature toggles and voice input, plus threads, projects, memories, an action panel and an inline text assistant.
KivaDataSourcePicker
Picks a Kiva data source (apps → data sources tree) and a sample record, then exposes a JSON Schema plus JSONata / Handlebars context paths through a render prop — API-aligned with the web KivaDataSourcePicker.