Skip to content

EntityCollection

@firecms/core


@firecms/core / EntityCollection

Defined in: types/collections.ts:20

This interface represents a view that includes a collection of entities. It can be in the root level of the configuration, defining the main menu navigation. You can also find it as a subcollection of a different one.

M extends Record<string, any> = any

USER extends User = any

optional Actions: ComponentType<CollectionActionsProps<any, User, EntityCollection<any, any>>> | ComponentType<CollectionActionsProps<any, User, EntityCollection<any, any>>>[]

Defined in: types/collections.ts:177

Builder for rendering additional components such as buttons in the collection toolbar


optional additionalFields: AdditionalFieldDelegate<M, USER>[]

Defined in: types/collections.ts:259

You can add additional fields to the collection view by implementing an additional field delegate.


optional alwaysApplyDefaultValues: boolean

Defined in: types/collections.ts:343

If set to true, the default values of the properties will be applied to the entity every time the entity is updated (not only when created). Defaults to false.


optional callbacks: EntityCallbacks<M, USER>

Defined in: types/collections.ts:171

This interface defines all the callbacks that can be used when an entity is being created, updated or deleted. Useful for adding your own logic or blocking the execution of the operation.


optional collectionGroup: boolean

Defined in: types/collections.ts:64

If this collection is a top level navigation entry, you can set this property to true to indicate that this collection is a collection group.


optional customId: boolean | EnumValues | "optional"

Defined in: types/collections.ts:221

If this property is not set, the property will be created by the datasource. You can set the value to true to allow the users to choose the ID. You can also pass a set of values (as an EnumValues object) to allow them to pick from only those.


optional databaseId: string

Defined in: types/collections.ts:58

Optional database id of this collection. If not specified, the default database id will be used.


optional defaultSelectedView: string | DefaultSelectedViewBuilder

Defined in: types/collections.ts:289

If you want to open custom views or subcollections by default when opening the edit view of an entity, you can specify the path to the view here. The path is relative to the current collection. For example if you have a collection that has a custom view as well as a subcollection that refers to another entity, you can either specify the path to the custom view or the path to the subcollection.


optional defaultSize: CollectionSize

Defined in: types/collections.ts:264

Default size of the rendered collection


optional description: string

Defined in: types/collections.ts:45

Optional description of this view. You can use Markdown.


optional editable: boolean

Defined in: types/collections.ts:336

Can this collection configuration be edited by the end user. Defaults to true. Keep in mind that you can also set this prop to individual properties. This prop has only effect if you are using the collection editor.


optional entityActions: (string | EntityAction<M, USER>)[]

Defined in: types/collections.ts:205

You can define additional actions that can be performed on the entities in this collection. These actions can be displayed in the collection view or in the entity view.

You can use the onClick method to implement your own logic. In the context prop you can access all the controllers of FireCMS.

const archiveEntityAction: EntityAction = {
icon: <ArchiveIcon/>,
name: "Archive",
onClick({
entity,
collection,
context,
}): Promise<void> {
// Add your code here
return Promise.resolve(undefined);
}
}

You can also pass the action as a string that represents the key, in which case it will use the action defined in the main configuration under entityActions.


optional entityViews: (string | EntityCustomView<M>)[]

Defined in: types/collections.ts:253

Array of builders for rendering additional panels in an entity view. Useful if you need to render custom views. You can either define the custom view inline or pass a reference to a custom view defined in the main configuration under entityViews


optional exportable: boolean | ExportConfig<USER>

Defined in: types/collections.ts:312


optional forceFilter: Partial<Record<Extract<keyof M, string>, [WhereFilterOp, any]>>

Defined in: types/collections.ts:229

Force a filter in this view. If applied, the rest of the filters will be disabled. Filters applied with this prop cannot be changed. e.g. forceFilter: { age: [">=", 18] } e.g. forceFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }


optional formAutoSave: boolean

Defined in: types/collections.ts:307

If set to true, the form will be auto-saved when the user changes the value of a field. Defaults to false. You can’t use this prop if you are using a customId


optional group: string

Defined in: types/collections.ts:85

Optional field used to group top level navigation entries under a~ navigation view. If you set this value in a subcollection it has no effect.

This prop is deprecated and will be removed in the future. You can apply grouping by using the navigationGroupMappings prop in the useBuildNavigationController hook instead.


optional hideFromNavigation: boolean

Defined in: types/collections.ts:280

Should this collection be hidden from the main navigation panel, if it is at the root level, or in the entity side panel if it’s a subcollection. It will still be accessible if you reach the specified path. You can also use this collection as a reference target.


optional hideIdFromCollection: boolean

Defined in: types/collections.ts:299

Should the ID of this collection be hidden from the grid view.


optional hideIdFromForm: boolean

Defined in: types/collections.ts:294

Should the ID of this collection be hidden from the form view.


optional history: boolean

Defined in: types/collections.ts:354

If set to true, changes to the entity will be saved in a subcollection. This prop has no effect if the history plugin is not enabled


optional icon: ReactNode

Defined in: types/collections.ts:75

Icon key to use in this collection. You can use any of the icons in the Material specs: https://fonts.google.com/icons e.g. ‘account_tree’ or ‘person’. Find all the icons in https://firecms.co/docs/icons You can also pass a React node if you want to render a custom icon. If not specified, a default icon will be used.


id: string

Defined in: types/collections.ts:28

You can set an alias that will be used internally instead of the path. The alias value will be used to determine the URL of the collection, while path will still be used in the datasource. Note that you can use this value in reference properties too.


optional includeJsonView: boolean

Defined in: types/collections.ts:348

If set to true, a tab including the JSON representation of the entity will be included.


optional initialFilter: Partial<Record<Extract<keyof M, string>, [WhereFilterOp, any]>>

Defined in: types/collections.ts:237

Initial filters applied to the collection this collection is related to. Defaults to none. Filters applied with this prop can be changed. e.g. initialFilter: { age: [">=", 18] } e.g. initialFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }


optional initialSort: [Extract<keyof M, string>, "desc" | "asc"]

Defined in: types/collections.ts:245

Default sort applied to this collection. When setting this prop, entities will have a default order applied in the collection. e.g. initialSort: ["order", "asc"]


optional inlineEditing: boolean

Defined in: types/collections.ts:271

Can the elements in this collection be edited inline in the collection view. If this flag is set to false but permissions.edit is true, entities can still be edited in the side panel


optional localChangesBackup: false | "manual_apply" | "auto_apply"

Defined in: types/collections.ts:366

Should local changes be backed up in local storage, to prevent data loss on accidental navigations.

  • manual_apply: When the user navigates back to an entity with local changes, they will be prompted to restore the changes.
  • auto_apply: When the user navigates back to an entity with local changes, the changes will be automatically applied.
  • false: Local changes will not be backed up. Defaults to manual_apply.

name: string

Defined in: types/collections.ts:34

Name of the collection, typically plural. E.g. Products, Blog


optional openEntityMode: "side_panel" | "full_screen"

Defined in: types/collections.ts:108

When editing an entity, you can choose to open the entity in a side dialog or in a full screen dialog. Defaults to full_screen.


optional overrides: EntityOverrides

Defined in: types/collections.ts:323

Overrides for the entity view, like the data source or the storage source.


optional ownerId: string

Defined in: types/collections.ts:318

User id of the owner of this collection. This is used only by plugins, or if you are writing custom code


optional pagination: number | boolean

Defined in: types/collections.ts:140

If enabled, content is loaded in batches. If false all entities in the collection are loaded. This means that when reaching the end of the collection, the CMS will load more entities. You can specify a number to specify the pagination size (50 by default) Defaults to true


path: string

Defined in: types/collections.ts:52

Relative path of this view to its parent. If this view is in the root the path is equal to the absolute one. This path also determines the URL in FireCMS, unless an alias is specified


optional permissions: Permissions | PermissionsBuilder<EntityCollection<any, any>, USER, M>

Defined in: types/collections.ts:152

Permissions the logged-in user can perform on this collection. If not specified everything defaults to true.


optional previewProperties: string[]

Defined in: types/collections.ts:95

Default preview properties displayed when this collection is referenced to.


properties: PropertiesOrBuilders<M>

Defined in: types/collections.ts:90

Set of properties that compose an entity


optional propertiesOrder: (string | Extract<keyof M, string>)[]

Defined in: types/collections.ts:131

Order in which the properties are displayed. If you are specifying your collection as code, the order is the same as the one you define in properties. Additional columns are added at the end of the list, if the order is not specified. You can use this prop to hide some properties from the table view. Note that if you set this prop, other ways to hide fields, like hidden in the property definition, will be ignored. propertiesOrder has precedence over hidden. - For properties use the property key. - For additional fields use the field key. - If you have subcollections, you get a column for each subcollection, with the path (or alias) as the subcollection, prefixed with subcollection:. e.g. subcollection:orders. - If you are using a collection group, you will also have an additional collectionGroupParent column. You can use this prop to hide some properties from the table view. Note that if you set this prop, other ways to hide fields, like hidden in the property definition,will be ignored. propertiesOrder has precedence over hidden.


optional selectionController: SelectionController<M>

Defined in: types/collections.ts:212

Pass your own selection controller if you want to control selected entities externally.

useSelectionController


optional selectionEnabled: boolean

Defined in: types/collections.ts:157

Are the entities in this collection selectable. Defaults to true


optional sideDialogWidth: string | number

Defined in: types/collections.ts:328

Width of the side dialog (in pixels) when opening an entity in this collection.


optional singularName: string

Defined in: types/collections.ts:40

Singular name of an entry in this collection E.g. Product, Blog entry


optional subcollections: EntityCollection<any, any>[]

Defined in: types/collections.ts:164

You can add subcollections to your entity in the same way you define the root collections. The collections added here will be displayed when opening the side dialog of an entity.


optional textSearchEnabled: boolean

Defined in: types/collections.ts:146

Flag to indicate if a search bar should be displayed on top of the collection table.


optional titleProperty: keyof M

Defined in: types/collections.ts:102

Title property of the entity. This is the property that will be used as the title in entity related views and references. If not specified, the first property simple text property will be used.