Field Groups
Field groups render individual form inputs, labels and a feedback component for a model attribute on the edit and create pages. They are used in the ModelEditForm
and ModelCreateForm
components.
The complete list of field group components is below.
Layout
The default layout is vertical. The other layouts are horizontal and floating. Individual fields can be configured to use a different layout by explicitly using the ModelFieldGroup
variant ie <ModelFieldGroupHorizontal model="blog" path="title"
.
Global horizontal layout
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroup: ModelFieldGroupHorizontal
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroup: ModelFieldGroupHorizontal
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroup: ModelFieldGroupHorizontal
}
}
}
}
Global floating layout
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroup: ModelFieldGroupFloating
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroup: ModelFieldGroupFloating
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroup: ModelFieldGroupFloating
}
}
}
}
Field behaviour
Change label
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroup: { props: { label: 'Awesome Title!' } }
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroup: { props: { label: 'Awesome Title!' } }
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroup: { props: { label: 'Awesome Title!' } }
}
}
}
}
tip
A better approach may be to set the label on the server side using rhino_properties_readable_name
.
Set read-only
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroup: { props: { readOnly: true } }
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroup: { props: { readOnly: true } }
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroup: { props: { readOnly: true } }
}
}
}
}
Change placeholder
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroup: { props: { placeholder: 'Please enter title...' } }
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroup: { props: { placeholder: 'Please enter title...' } }
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroup: { props: { placeholder: 'Please enter title...' } }
}
}
}
}
ModelFieldGroupReference
Additional filtering
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroupReference: { props: { filter: { published: true } } }
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroupReference: { props: { filter: { published: true } } }
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
title: {
ModelFieldGroupReference: { props: { filter: { published: true } } }
}
}
}
}
ModelFieldGroupOwnerReference
Additional filtering
By default, the owner reference field group will only show items owned by the current base owner.
- Global
- Model
- Attribute
const rhinoConfig = {
version: 1,
components: {
ModelFieldGroupReference: { props: { filter: { archived: false } } }
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
ModelFieldGroupReference: { props: { filter: { archived: false } } }
}
}
}
const rhinoConfig = {
version: 1,
components: {
blog: {
category: {
ModelFieldGroupReference: { props: { filter: { archived: false } } }
}
}
}
}