# doc Layout

Doc layout is array of field that help you to manage the layout of the fields in the document.

with doc layout you can add custom fields, fields with condition :<br>

### Render fields in the same Row

```
module.exports = function (app) {
  const Model = createModel(app);
  const paginate = app.get('paginate'); // Register validators to validate schema and to register dashboard screen;

  const options = {
    Model,
    paginate,
    serviceRules,
    dashboardConfig: {
      docLayout: 
      [
        '_id',
        ['firstName', 'lastName']
      ]
    }
  };

  // Initialize our service with any options it requires
  app.use('/invitations', new Invitations(options));

  // Get our initialized service so that we can register hooks
  const service = app.service('invitations');

  service.hooks(hooks);
};
```

### Render custom field - link type

```
docLayout: [
        {
          type: 'custom',
          customFieldType: 'link',
          style: 'button',
          linkTemplate: 'dashboard/floor-plan?floorId={{ _id }}',
          label: 'Plan',
          itemKey: 'linkToPlan',
          hideOnCreate: true,
          hideOnUpdate: false,
         }
]
```

### Render field with condition&#x20;

```
// equalTo
docLayout : [
  {
    when: {
      field: 'type',
      equalTo: OFFICES_TYPE.other,
      then: 'other_type'
    }
  }
]
// conditions (read sift query - https://github.com/crcn/sift.js/tree/master)
docLayout : [
  {
    when: {
      conditions: {tags: { $in: ["hello", "world"] }},
      then: 'other_type',
      otherwise: 'tags'
    }
  }
]
```

{% content-ref url="/pages/-Lt4F6y6889zUUvpl-xb" %}
[Broken mention](broken://pages/-Lt4F6y6889zUUvpl-xb)
{% endcontent-ref %}

{% content-ref url="/pages/-LtJIwa0vyIH36efmikq" %}
[customElements](/feathers-mongoose-casl/docs/guides/dashboard/service-configuration/custom-fields/customelements.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://feathersjs-mongoose.gitbook.io/feathers-mongoose-casl/docs/guides/dashboard/service-configuration/doc-layout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
