Interface: EntityCollection<M, USER>
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.
Type Parameters​
• M extends Record
<string
, any
> = any
• USER extends User
= any
Properties​
Actions?​
optional
Actions:ComponentType
<CollectionActionsProps
<any
,User
,EntityCollection
<any
,any
>>> |ComponentType
<CollectionActionsProps
<any
,User
,EntityCollection
<any
,any
>>>[]
Builder for rendering additional components such as buttons in the collection toolbar
Defined in​
packages/firecms_core/src/types/collections.ts:167
additionalFields?​
optional
additionalFields:AdditionalFieldDelegate
<M
,USER
>[]
You can add additional fields to the collection view by implementing an additional field delegate.
Defined in​
packages/firecms_core/src/types/collections.ts:244
callbacks?​
optional
callbacks:EntityCallbacks
<M
,USER
>
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.
Defined in​
packages/firecms_core/src/types/collections.ts:161
collectionGroup?​
optional
collectionGroup:boolean
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.
Defined in​
packages/firecms_core/src/types/collections.ts:64
customId?​
optional
customId:boolean
|EnumValues
|"optional"
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.
Defined in​
packages/firecms_core/src/types/collections.ts:208
databaseId?​
optional
databaseId:string
Optional database id of this collection. If not specified, the default database id will be used.
Defined in​
packages/firecms_core/src/types/collections.ts:58
defaultSelectedView?​
optional
defaultSelectedView:string
|DefaultSelectedViewBuilder
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.
Defined in​
packages/firecms_core/src/types/collections.ts:274
defaultSize?​
optional
defaultSize:CollectionSize
Default size of the rendered collection
Defined in​
packages/firecms_core/src/types/collections.ts:249
description?​
optional
description:string
Optional description of this view. You can use Markdown.
Defined in​
packages/firecms_core/src/types/collections.ts:45
editable?​
optional
editable:boolean
Can this collection be edited by the end user.
Defaults to true
.
Keep in mind that you can also set this prop to individual properties.
Defined in​
packages/firecms_core/src/types/collections.ts:99
entityActions?​
optional
entityActions:EntityAction
<M
,USER
>[]
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);
}
}
Defined in​
packages/firecms_core/src/types/collections.ts:192
entityViews?​
optional
entityViews: (string
|EntityCustomView
<M
>)[]
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
Defined in​
packages/firecms_core/src/types/collections.ts:238
exportable?​
optional
exportable:boolean
|ExportConfig
<USER
>
Defined in​
packages/firecms_core/src/types/collections.ts:297
forceFilter?​
optional
forceFilter:Partial
<Record
<Extract
<keyofM
,string
>, [WhereFilterOp
,any
]>>
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] }
Defined in​
packages/firecms_core/src/types/collections.ts:215
formAutoSave?​
optional
formAutoSave:boolean
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
Defined in​
packages/firecms_core/src/types/collections.ts:292
group?​
optional
group:string
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.
Defined in​
packages/firecms_core/src/types/collections.ts:80
hideFromNavigation?​
optional
hideFromNavigation:boolean
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.
Defined in​
packages/firecms_core/src/types/collections.ts:265
hideIdFromCollection?​
optional
hideIdFromCollection:boolean
Should the ID of this collection be hidden from the grid view.
Defined in​
packages/firecms_core/src/types/collections.ts:284
hideIdFromForm?​
optional
hideIdFromForm:boolean
Should the ID of this collection be hidden from the form view.
Defined in​
packages/firecms_core/src/types/collections.ts:279
icon?​
optional
icon:string
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
Defined in​
packages/firecms_core/src/types/collections.ts:73
id​
id:
string
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.
Defined in​
packages/firecms_core/src/types/collections.ts:28
initialFilter?​
optional
initialFilter:Partial
<Record
<Extract
<keyofM
,string
>, [WhereFilterOp
,any
]>>
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] }
Defined in​
packages/firecms_core/src/types/collections.ts:222
initialSort?​
optional
initialSort: [Extract
<keyofM
,string
>,"asc"
|"desc"
]
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"]
Defined in​
packages/firecms_core/src/types/collections.ts:230
inlineEditing?​
optional
inlineEditing:boolean
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
Defined in​
packages/firecms_core/src/types/collections.ts:256
name​
name:
string
Name of the collection, typically plural.
E.g. Products
, Blog
Defined in​
packages/firecms_core/src/types/collections.ts:34
overrides?​
optional
overrides:EntityOverrides
Overrides for the entity view, like the data source or the storage source.
Defined in​
packages/firecms_core/src/types/collections.ts:308
ownerId?​
optional
ownerId:string
User id of the owner of this collection. This is used only by plugins, or if you are writing custom code
Defined in​
packages/firecms_core/src/types/collections.ts:303
pagination?​
optional
pagination:number
|boolean
If enabled, content is loaded in batches. If false
all entities in the
collection are loaded.
You can specify a number to specify the pagination size (50 by default)
Defaults to true
Defined in​
packages/firecms_core/src/types/collections.ts:130
path​
path:
string
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
Defined in​
packages/firecms_core/src/types/collections.ts:52
permissions?​
optional
permissions:Permissions
|PermissionsBuilder
<EntityCollection
<any
,any
>,USER
,M
>
Permissions the logged-in user can perform on this collection.
If not specified everything defaults to true
.
Defined in​
packages/firecms_core/src/types/collections.ts:142
previewProperties?​
optional
previewProperties:string
[]
Default preview properties displayed when this collection is referenced to.
Defined in​
packages/firecms_core/src/types/collections.ts:318
properties​
properties:
PropertiesOrBuilders
<M
>
Set of properties that compose an entity
Defined in​
packages/firecms_core/src/types/collections.ts:85
propertiesOrder?​
optional
propertiesOrder: (Extract
<keyofM
,string
> | `subcollection:${string}`)[]
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 columns use the column id.
- 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, likehidden
in the property definition,will be ignored.propertiesOrder
has precedence overhidden
.
Defined in​
packages/firecms_core/src/types/collections.ts:122
selectionController?​
optional
selectionController:SelectionController
<M
>
Pass your own selection controller if you want to control selected entities externally.
See​
useSelectionController
Defined in​
packages/firecms_core/src/types/collections.ts:199
selectionEnabled?​
optional
selectionEnabled:boolean
Are the entities in this collection selectable. Defaults to true
Defined in​
packages/firecms_core/src/types/collections.ts:147
sideDialogWidth?​
optional
sideDialogWidth:string
|number
Width of the side dialog (in pixels) when opening an entity in this collection.
Defined in​
packages/firecms_core/src/types/collections.ts:313
singularName?​
optional
singularName:string
Singular name of an entry in this collection
E.g. Product
, Blog entry
Defined in​
packages/firecms_core/src/types/collections.ts:40
subcollections?​
optional
subcollections:EntityCollection
<any
,any
>[]
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.
Defined in​
packages/firecms_core/src/types/collections.ts:154
textSearchEnabled?​
optional
textSearchEnabled:boolean
Flag to indicate if a search bar should be displayed on top of the collection table.
Defined in​
packages/firecms_core/src/types/collections.ts:136
titleProperty?​
optional
titleProperty: keyofM
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.