-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06afc83
commit 30db008
Showing
2 changed files
with
2 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,5 @@ | ||
--- | ||
description: Panels are customizable components within Directus Insights dashboards. | ||
description: | ||
--- | ||
|
||
# Dashboard Panels | ||
|
||
Panels are customizable components within :product-link{product="insights"} dashboards. | ||
|
||
Panels are the building blocks of analytics dashboards, enabling rapid, no-code creation of data visualizations with data from a Directus project. Panels can also contain interactive elements, making them suitable for building custom internal applications within dashboards. | ||
|
||
<!-- TODO: Image --> | ||
|
||
:partial{content="extensions-app"} | ||
|
||
## Panel Entrypoint | ||
|
||
The `index.js` or `index.ts` file exports an object that is read by Directus. It contains properties that control how a panel is displayed within menus, it’s minimum width and height on the dashboard grid, what configurable options will be available to users, and the actual Vue component that will be loaded. | ||
|
||
### Entrypoint Example | ||
|
||
```js | ||
import PanelComponent from './panel.vue'; | ||
|
||
export default { | ||
id: 'custom', | ||
name: 'Custom', | ||
icon: 'box', | ||
description: 'This is my custom panel!', | ||
component: PanelComponent, | ||
minWidth: 12, | ||
minHeight: 8, | ||
options: [ | ||
{ | ||
field: 'text', | ||
name: 'Text', | ||
type: 'string', | ||
meta: { | ||
interface: 'input', | ||
width: 'full', | ||
}, | ||
}, | ||
], | ||
}; | ||
``` | ||
|
||
### Properties | ||
|
||
| Property | Type | Description | | ||
| ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | | ||
| `id` | string | A unique identifier for this extension. | | ||
| `name` | string | The displayed name for this panel in the Data Studio. | | ||
| `icon` | string | An icon name from the [Google Material Icons set](https://fonts.google.com/icons). Supports filled and outlined variants. | | ||
| `description` | string | A description of this panel shown in the Data Studio. Maximum 80 characters. | | ||
| `component` | component | A reference to the Vue component rendered in the dashboard. | | ||
| `minWidth` | number | Smallest number of grid units in the dashboard. | | ||
| `minHeight` | number | Smallest number of grid units in the dashboard. | | ||
| `options` | array | component | When an array, options contains user-configurable fields that are set when creating or editing the panel. | ||
| `preview` | string | Inline SVG to display in panel selection drawer. | | ||
|
||
:partial{content="extensions-uid"} | ||
|
||
:partial{content="extensions-theme"} | ||
|
||
## Panel Component | ||
|
||
The panel component is a Vue component that will be rendered in the Data Studio within a dashboard. Data from the entrypoint is passed in as props. | ||
|
||
### Component Example | ||
|
||
This example assumes there is an item in the entrypoint’s `options` array with a `field` value of `text`. | ||
|
||
```vue | ||
<template> | ||
<div class="text" :class="{ 'has-header': showHeader }"> | ||
{{ text }} | ||
</div> | ||
</template> | ||
<script setup> | ||
defineProps(['showHeader', 'text']); | ||
</script> | ||
<style scoped> | ||
.text { | ||
padding: 12px; | ||
} | ||
.text.has-header { | ||
padding: 0 12px; | ||
} | ||
</style> | ||
``` | ||
|
||
### Props | ||
|
||
The panel component will be passed all user configuration options from the entrypoint file. It will also receive the following props: | ||
|
||
| Prop | Type | Description | | ||
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------ | | ||
| `id` | uuid | The UUID for this panel. This is for a specific instance of the panel and will not be the defined `id` in the entrypoint file. | | ||
| `dashboard` | uuid | The UUID for the dashboard containing the panel. | | ||
| `showHeader` | boolean | Whether the panel header visibility is enabled in the options. | | ||
| `width` | number | The current number of grid units wide the panel is. | | ||
| `height` | number | The current number of grid units high the panel is. | | ||
| `now` | date | The date object at the time of loading the dashboard. | | ||
|
||
:partial{content="extensions-app-internals"} | ||
# Dashboard Panels |