[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationRow drawers

Row drawers

Open a row in a module's own drawer, modal or side panel, step through the rows with J and K, and link to it.

A detail drawer, such as an API request, an automation run or a sent email, is a custom row action whose target opens a component of your frontend layer in a drawer, or a modal. The table hands that component the row, and the means to step to the neighbouring rows; deepLink keeps the open row in the URL.

Detail and record panels use drawers: a drawer opened on a row takes every option of the side panel: the DMS's row header with the row's position, previous and next, the deep link, and the not-found state (Detail drawers). The user can resize it. The sidePanel target, docked next to the page, is meant for global, page-independent panels such as an assistant dock.

Table TableView
Connecting to the DMS preview…
Connecting DMS 0.25.8 7 options set

The example above opens Helio's projects in drawers (formContainer: { type: "drawer" }). Edit a project: the drawer opens on the row without leaving the table. Save it: the drawer closes on the save. The docs site's route keeps nothing, so the table lists the project as it was. Open New entry, type a name and close the drawer: it asks whether to keep editing or discard the unsaved changes.

src/pages/runs.ts ts
rowActions: {
  custom: [
    {
      label: "Run details",
      icon: "i-ph-sidebar-simple",
      isDefault: true, // a click on the row opens it
      deepLink: true,  // ?record=<id>
      target: {
        type: "drawer",
        component: CustomComponent("RunDetailsDrawer"),
        title: "Run details",
      },
    },
  ],
},

The drawer slides in from the bottom. direction: "right" (or "left", "top") opens it from that edge instead: a left or right drawer is a side sheet spanning the window's height, the shape of an inspector or a detail panel, 600px wide from lg (see Size and resizing).

isDefault: true makes the action what a click on the row does, ahead of the built-in edit and details. The first flagged action whose rule accepts the row wins.

The component's props

The component receives the target's own component options, plus:

PropTypePurpose
rowDataobjectThe row, as the list returned it.
navigationRowNavigation | undefinedSteps through the rows the table shows (below). Unset when the row is not among them.
showRow(row: object | string) => Promise<void>Shows another row of the same table in place, by row or by id (below).
onSuccessCallback() => voidCloses the container and refreshes the table, for a component that changed the row.
pageId, componentId, containerIdstringWhere the container belongs.

RowNavigation is { index, total, hasPrev, hasNext, prev(), next() }: index is the row's position among all the rows the table lists (from 0), total the table's count, not only the page loaded. prev() and next() show the neighbouring row in place: the drawer or modal stays open, its component is mounted again with the new rowData and navigation. Past the rows loaded, a step turns the table's page (or grows its loadMore / infinite feed) and lands on the row that follows once it arrived: on a table of 87 rows paged by 50, row 50 shows "50 of 87" and next opens row 51 on page 2. A step goes to the open row's neighbour in the table's current order, found by its id, never by a position the rows may have moved from: on a live table, rows arriving or leaving while the container is open never make J skip or revisit a row. A row the loaded rows do not hold, such as a deep link to row 28 while page 1 shows 25, or a live row pushed down past the page, is looked for in the table's whole result, under its current query, a window of rows at a time: it gets its position and its neighbours as a listed row does (past the first 5,000 rows it opens without them). The order is the one the table shows: on a table with pinnedRows whose route answers one page, each page leads with its own pinned rows, and the position and the steps count them where they stand on their page, from a click as from a deep link. A display that reads its own rows (selfManagedData) keeps to the rows it shows, in its own order: a card opened on the kanban steps through the cards column by column, the ones a column's "load more" added included. J and K do the same while the container is open, unless the user types in a field.

app/components/RunDetailsDrawer.vue vue
<script setup lang="ts">
interface RowNavigation {
  index: number;
  total: number;
  hasPrev: boolean;
  hasNext: boolean;
  prev: () => void;
  next: () => void;
}

const props = defineProps<{ rowData?: { name?: string }; navigation?: RowNavigation }>();
</script>

<template>
  <div v-if="props.navigation" class="flex items-center gap-1">
    <span>{{ props.navigation.index + 1 }} / {{ props.navigation.total }}</span>
    <UButton icon="i-ph-caret-up" :disabled="!props.navigation.hasPrev" @click="props.navigation.prev()" />
    <UButton icon="i-ph-caret-down" :disabled="!props.navigation.hasNext" @click="props.navigation.next()" />
  </div>
  <h3>{{ props.rowData?.name }}</h3>
</template>

The steps follow the table's current query and sort (its filters, its search, its tab) across all its pages.

Blocks reading the row

The component may be a block declared on the backend rather than one of your frontend layer: a ResourceForm, a Form, any block taking URLs. Such a block reads the row from its options, which name it with {{row.X}} tokens: {{row.<field>}} is a field of the row the container shows, a dotted path reaching into it, and {{row.id}} its id read through the table's rowIdKey. The container fills them for each row it shows (on opening, on each step with the buttons or J and K, and on showRow), and mounts the block anew, so it loads the row the header names. An option named for a URL (fetchUrl, submitUrl, any …Url, to) is filled percent-encoded; any other (rowId, a title) takes the values as they are. A table inside the container keeps the tokens of its own rowActions and fetchRowUrl for its own rows.

src/pages/orders.ts ts
import { ResourceForm, TableView } from "@antelopejs/interface-dms/base/table-view";

static orders = TableView(orderDataAPI, {
  rowClick: "single",
  rowActions: {
    custom: [
      {
        label: "Order",
        isDefault: true,
        target: {
          type: "sidePanel",
          title: "Order",
          rowTitle: "{reference}",
          // reads /api/orders/get?id=<the row shown>, again on each step
          component: ResourceForm(orderDataAPI, { mode: "view", rowId: "{{row._id}}" }),
        },
      },
    ],
  },
});

The component may also be a container block holding others, such as a Card, a VStack, a Grid or a Tab, drawn as a page draws it, its children in their slots. Each child's options take the same {{row.X}} tokens, filled for each row shown; the container itself receives what a single block does (rowData, navigation, onSuccessCallback).

src/pages/orders.ts ts
import { Card, KeyValueList } from "@antelopejs/interface-dms/base";

target: {
  type: "sidePanel",
  title: "Order",
  component: Card({ title: "{{row.reference}}" })
    .child("facts", KeyValueList({ fetchUrl: "/api/orders/{{row._id}}/facts" })),
},

Prefer {{row._id}} to {{query.record}} there: the table writes ?record= in place as the user steps, without a visit, so a page token keeps reading the row the page was loaded on. A container opened without a row, by a bulk action or a toolbar button, hands the options as declared: a ResourceForm then shows "No entry selected".

Showing another row

A component that links to another row of the same table, such as a send and the send it replays, or an order and its refund, calls showRow with that row, or its id, rather than drawing it on its own. The container shows it in place, exactly as a step does: its component is mounted again with the new rowData and navigation, the URL's ?record= names it on a deep-linked action, and a side panel moves its header's position and the table's highlight onto it.

An id is looked up among the rows the table shows, else read through the controller's get route (on a TableView.fromSource table, its fetchRowUrl), as a deep link is. A row the table lists past the page loaded gets its navigation once it is located in the table's result (above); a row the table does not list at all (filtered out) opens without it: the header then shows no position, and J / K wait until a listed row is open. When the route answers 404, a side panel shows its not-found state. Otherwise (a drawer or a modal on a missing row, a refused read, a source table without fetchRowUrl), the promise rejects and the container keeps the row it had.

app/components/SendPanel.vue vue
<script setup lang="ts">
const props = defineProps<{
  rowData?: { replayOf?: string };
  showRow?: (row: object | string) => Promise<void>;
}>();
const toast = useToast();

const openReplayed = (id: string) =>
  props.showRow?.(id).catch(() => toast.add({ color: "error", title: "This send could not be opened" }));
</script>

<template>
  <UButton v-if="props.rowData?.replayOf" label="See the original send" @click="openReplayed(props.rowData.replayOf)" />
</template>

Detail drawers

A drawer opened on a row takes the options of a side panel, so a module moves a detail panel from type: "sidePanel" to type: "drawer" without losing any:

OptionEffect
rowTitleThe drawer's title while a row is open: an i18n key or a literal receiving the row's fields ("{method} {path}" reads "POST /api/orders"). title stays the title of a drawer showing no row.
positionLabelThe row's position among all the rows the table lists, under the title: an i18n key receiving {index} (from 1) and {total} ("Request 4 of 50"), both written with the locale's digit grouping ("26 120"); "4 of 50" by default.
rowHeaderThe DMS draws the row header: the title, the position, previous and next buttons next to the close button. On once rowTitle or positionLabel is set; true draws it with the defaults, false keeps the drawer's own title (a component drawing its own navigation).
deepLinktrue keeps the open row in the URL (?record=<id>), as the action's own deepLink does. The action's own wins when set. Off by default for a drawer.
notFound{ title?, description? }: a deep link to a row its route answers 404 for opens the drawer on this state, with a Close button, instead of the "no longer available" toast.
sizeThe width a side drawer opens at (below).

A drawer a module opens itself with useDrawer, on a row of a list it draws, gets the same header through its rowHeader option.

J and K step to the next and previous row in place whatever the header, and the header's buttons do the same: the drawer stays open, its component is mounted again on the row, its title and position follow, and on a deep-linked action ?record= names the new row. Back and Forward follow ?record= too: the table opens the row the URL names, as on a fresh load.

src/pages/requests.ts ts
rowActions: {
  custom: [
    {
      label: "Request",
      isDefault: true,
      target: {
        type: "drawer",
        direction: "right",
        component: CustomComponent("RequestPanel"),
        title: "$api.request.title",
        rowTitle: "$api.request.heading", // "{method} {path}"
        positionLabel: "$api.request.position", // "Request {index} of {total}"
        deepLink: true, // ?record=<id>
        notFound: { title: "$api.request.not_found_title" },
      },
    },
  ],
},

Size and resizing

From lg, every drawer is resizable: a row action's, a form's (container: { type: "drawer" }), and one a module opens with useDrawer. A handle on its inner edge sets the width of a left / right drawer, the height of a top / bottom one. Drag it, or focus it and use the arrow keys (Home and End for the bounds); a double-click gives the drawer its default size back.

  • A side drawer opens at 600px without a size, capped to the window less a margin. size opens it at a modal's width instead (sm 384px, md 448, lg 512, xl 576, 2xl 672, 3xl 768, 4xl 896, 5xl 1024). It stays between 360px and 90% of the window.
  • A top or bottom drawer keeps its natural height until resized, and stays under 90% of the window's height.
  • The size the user leaves a drawer at is remembered on the device, per drawer: a row action's per table and component, another drawer per sizeKey (its containerId by default, else its component's name, so a module's drawer keeps its size without one). The same drawer opens again at that size.

The drawer's header (its title, a row's position and steps, the close button) stays in view: only the body scrolls, and a form's footer sticks to the bottom of it. A side drawer draws no drag grip (it is not dragged away); a top or bottom one keeps it below lg. The drawer's body is a size container: a form, a key/value list or a module's component laid out with container queries (@container units, Tailwind's @min-[…] variants) follows the drawer as it is resized, not the window. A form sets its labels beside the values from 560px of its own width and keeps wide fields (a repeater, pairs, code) under their label (Forms).

Below lg drawers keep their phone layout: an unsized side drawer is 440px wide, a sized one a modal's width at its size, both capped to the screen less a 32px strip of backdrop, so every side drawer looks the same on a phone (only full fills the screen), and there is no handle.

Closing a drawer releases the page at once: as soon as the close starts, the page takes clicks again and the backdrop lets them through, fading out in 100ms (immediately with reduced motion), while the drawer itself still slides out. Close a row's drawer and click the next row straight away. Resizing a drawer does not change that: the next click outside it closes it.

With deepLink: true, the open row is written to the URL while its container is open: ?record=<id>, or ?<tableId>.record=<id> on a page carrying several table views (tableId being the key the table view is mounted under). Opening that URL from a link, a reload or a notification opens the action again on that row. A row the page does not list is read through the controller's get route (on a TableView.fromSource table, through its fetchRowUrl), and gets its position and navigation once it is located in the table's whole result, under its current query (a row past the first 5,000, or one the query filters out, opens without them). A table restores the first of its custom actions declaring deepLink (on the action, or on a drawer's target) or opening a side panel, which keeps the row in the URL by default. A visit that keeps the page mounted, such as a link to the same page naming another row, or the same row again once its container closed, opens that row too, as a fresh load would; a link to the row already open opens nothing more.

When no row answers the link, because the row was deleted or a source table has no fetchRowUrl to read a row it does not list, the table removes the key from the URL and shows a warning toast, "This entry is no longer available". A side panel target shows that state in the panel instead (see Side panel), and so does a drawer whose target sets notFound (Detail drawers). When the read fails for another reason (the route refused it, the network, a server error), the row may still exist: the table removes the key too, but says "This entry could not be opened" instead, for every target.

Side panel

Note

The side panel is meant for global, page-independent panels, such as an assistant dock. A detail or record panel opens in a drawer, which takes the same options. type: "sidePanel" keeps working as described here.

A sidePanel is a non-modal panel docked on the right of the page, which shrinks to make room and stays usable. The DMS draws the panel's header, so the component only renders the row:

  • the action's title, or, with rowTitle, a title naming the open row: an i18n key or a literal receiving the row's fields, as a confirmation's texts do ("{method} {path}" reads "POST /api/orders");
  • the row's position among all the rows the table lists, "3 of 20" by default. positionLabel words it, an i18n key receiving {index} (from 1) and {total}, already written with the locale's digit grouping ("Request 4 of 26 120");
  • previous and next buttons, and J / K;
  • a close button, and Escape (once the table has no search or selection to clear).

J, K and Escape are listed in the shortcuts help, under the table view.

src/pages/requests.ts ts
import { CustomComponent } from "@antelopejs/interface-dms/base/custom";
import { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types";
import { TableView } from "@antelopejs/interface-dms/base/table-view";

TableView.fromSource({
  fetchUrl: "/api/requests",
  columns: {
    method: { name: "Method", type: new DefaultDataTypes.StringType() },
    path: { name: "Path", type: new DefaultDataTypes.StringType() },
  },
  rowClick: "single", // one click opens the row
  rowActions: {
    custom: [
      {
        label: "Request",
        isDefault: true,
        target: {
          type: "sidePanel",
          component: CustomComponent("RequestPanel"),
          title: "$api.request.title",
          rowTitle: "$api.request.heading", // "{method} {path}"
          positionLabel: "$api.request.position", // "Request {index} of {total}"
          notFound: {
            title: "$api.request.not_found_title", // "This request is no longer stored"
            description: "$api.request.not_found_description",
          },
          // ?record=<id> by default; deepLink: false opts out
        },
      },
    ],
  },
});
app/components/RequestPanel.vue vue
<script setup lang="ts">
const props = defineProps<{ rowData?: { method?: string; path?: string } }>();
</script>

<template>
  <dl>
    <dt>Method</dt>
    <dd>{{ props.rowData?.method }}</dd>
    <dt>Path</dt>
    <dd>{{ props.rowData?.path }}</dd>
  </dl>
</template>

The component receives the same props as a drawer's (above) and is mounted anew on each row; onSuccessCallback closes the panel and refreshes the table. Moving to another row swaps the content in place, and the table highlights the open row: the accent tint of a selected row, with a 2px accent bar on its leading edge. The position follows the table: a refresh or live rows that move the row update it, a row pushed past the page loaded is located in the table's result, a step past the page loaded turns the page as a drawer's does, and a row no longer listed shows without it.

A side panel keeps the open row in the URL by default, as a drawer with deepLink does, and deepLink: false on the target or the action opts out. A reload or a shared link opens the panel again on that row, and closing it removes the key of that row on that page only, so a panel closing as the user follows a link leaves the next page's ?record= alone. A TableView.fromSource table reads that row among the rows it lists, once they arrived, else through its fetchRowUrl, and locates it in its result as a drawer does.

When that read answers 404 (a row deleted, pruned by a retention, a link with a wrong id), the panel still opens, under the target's title, and says the row is gone in place of the component: "This entry is no longer available", with a Close button that also removes the ?record= key. notFound: { title, description } words it in the module's terms (i18n keys or literals). Any other failure (a refusal, the network) opens nothing and shows the "could not be opened" toast described above.

One side panel is open at a time: the row panel closes a module's side panel (Dashboard chrome), and the other way round. It closes with its table, when the user leaves the page. Below lg, it is a sheet over the page. A side panel cookie naming it after a reload shows nothing until a row opens.

A custom toolbar or header button can open a sidePanel too: its component then receives no row, and the header has no position.

Row click

A double-click on a row runs its click action: the isDefault custom action, else edit or details. rowClick: "single", on TableView and TableView.fromSource, makes it a single click, the way a list read in a side panel expects. A click on a control of the row (a button, a link, the selection checkbox, the row menu) stays that control's, and a click ending a text selection opens nothing. Without the option, a table keeps the double-click.

Bulk actions in a drawer

A bulk action whose target is a drawer, a modal or a side panel receives a selection prop instead of rowData and navigation: see Bulk actions.