# Ynch navigation

Routes, route parameters and the tab bar.

Full docs: https://docs.ynch.ai/llms.txt (every page is markdown at its address plus `.md`).

## Rules

1. Edit only files inside `.ynch`. Never change `projectId` in `project.json`, and never edit `ynch.lock`.
2. Use only the components, props, style options and icons listed here. There are no custom components, no CSS, no JavaScript and no SQL. An unknown property is an error.
3. Every JSON file starts with `"schemaVersion": "1.0.0"`. Strict JSON: no comments, no trailing commas.
4. Ids are lowercase letters, digits and hyphens, starting with a letter. A file's name is its id.
5. After every change run `npx ynch check` and fix everything it reports. Do not remove a requested feature to silence an error.
6. Never write passwords, keys or tokens into any file.
7. Do not run `ynch upload`. The person uploads and approves each version in Ynch Studio.

## Routes

`.ynch/navigation.json`: `{"schemaVersion":"1.0.0","initialRoute":"home","routes":[{"id":"home","screenId":"home","label":"Home","parameters":{}}]}`

- Every screen has exactly one route. `initialRoute` takes no required parameters.
- Parameters are typed like model fields: `"parameters":{"id":{"type":"integer","required":true,"minimum":1}}`.

## Going to a route

`{"id":"open","type":"Button","props":{"label":"Open"},"action":{"type":"navigate","routeId":"detail","parameters":{"id":{"source":"field","model":"item","field":"id"}}}}`

Supply every required parameter and no extra ones. Types are never converted.

## Tab bar (optional)

`"tabBar":{"items":[{"routeId":"home","label":"Home","icon":"home"},{"routeId":"about","label":"About","icon":"activity"}],"style":"full-width","material":"glass","labels":"shown"}`

- 2 to 5 items, each a different route with no parameters. `initialRoute` must be one of them.
- `style`: floating (default) or full-width. `material`: solid (default) or glass. `labels`: shown (default) or hidden.
- Icons: activity, plus, check, chevron-right, trash, home, edit.
