You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-7Lines changed: 45 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,16 +180,41 @@ definePageMeta({
180
180
});
181
181
```
182
182
183
-
## Icons
183
+
## Types
184
+
185
+
To add types to the database schema of the directus client, add a file `your-extension/index.d.ts` with the following content:
186
+
187
+
```ts
188
+
declareglobal {
189
+
interfaceCollectivoSchema {
190
+
example_collection:ExampleCollection[];
191
+
}
192
+
193
+
interfaceExampleCollection {
194
+
id:number;
195
+
example_field:string;
196
+
}
197
+
}
184
198
185
-
Collectivo uses [`nuxt-ui`](https://ui.nuxt.com/getting-started/theming#icons) and [`Iconify`](https://iconify.design/) to load icons. They have to be defined as `i-{collection_name}-{icon_name}`.
199
+
export {};
200
+
```
186
201
187
-
By default, Collectivo loads the following to icon libraries:
202
+
You can then enjoy type checking when using directus:
188
203
189
-
-[System UIcons](https://icones.js.org/collection/system-uicons) for the UI
190
-
-[Mono Icons](https://icones.js.org/collection/mi) for form components
204
+
```ts
205
+
const directus =useDirectus();
206
+
const data =awaitdirectus.request(readItems("example_collection"));
207
+
```
191
208
192
-
Additional libraries can be loaded in `nuxt.config.ts`.
209
+
Typescript will then know that data is a `ExampleCollection[]` and that `data[0].example_field` is a string.
210
+
211
+
## Icons
212
+
213
+
Collectivo uses [`nuxt-ui`](https://ui.nuxt.com/getting-started/theming#icons) and [`Iconify`](https://iconify.design/) to load icons. They have to be defined as `i-{collection_name}-{icon_name}`. By default, Collectivo uses the [HeroIcons](https://icones.js.org/collection/heroicons) library. Additional libraries can be loaded in [`nuxt.config.ts`](https://ui.nuxt.com/getting-started/theming#icons).
214
+
215
+
## Dashboard
216
+
217
+
You can create custom components that can be displayed inside a dashboard tile. To do so, create a new component file `components/global/`. Then, add a new dashboard tile to your database and set the field `Component` to the name of your tile.
0 commit comments