Skip to content

Commit 4b888f9

Browse files
committed
docs: add filtering & sorting page, update components and CMS docs for 0.2.0
Cover the two major 0.2.0 features: collection filtering/sorting with full operator reference, and components in rich text. Also expand component variable types (audio, video, icon), document cascading overrides, enhance dynamic pages with collection list setup/pagination, and note semantic label tags on form inputs. Made-with: Cursor
1 parent 70f1c3e commit 4b888f9

File tree

8 files changed

+244
-13
lines changed

8 files changed

+244
-13
lines changed

content/cms/_meta.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import type { MetaRecord } from 'nextra'
33
const meta: MetaRecord = {
44
collections: 'Collections',
55
items: 'Items',
6-
'dynamic-pages': 'Dynamic Pages'
6+
'dynamic-pages': 'Dynamic Pages',
7+
filtering: 'Filtering & Sorting'
78
}
89

910
export default meta

content/cms/collections.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ You add custom fields to define the structure of your content. Field types are g
3535
| Type | Description |
3636
|------|-------------|
3737
| **text** | Single-line text |
38-
| **rich_text** | Formatted content with the rich text editor |
38+
| **rich_text** | Formatted content with the rich text editor; supports bold, italic, links, lists, headings, and embedded [components](/docs/editor/components) |
3939
| **number** | Numeric values |
4040
| **boolean** | True/false toggle |
4141
| **date** | Date and time values |

content/cms/dynamic-pages.mdx

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: Dynamic Pages
33
---
44

5+
import { Callout } from 'nextra/components'
6+
57
# Dynamic Pages
68

79
Bind collection data to your pages for dynamic, data-driven content.
@@ -26,10 +28,43 @@ Once a page is connected to a collection, you can bind collection fields to elem
2628

2729
Text elements, images, links, and other elements can all be bound to collection data.
2830

29-
## Dynamic Lists
31+
## Collection Lists
32+
33+
To show multiple items on a single page (e.g., a blog listing), use a **Collection List** element. The collection list repeats its child layers for each item in the connected collection.
34+
35+
### Setup
36+
37+
1. Add a **Collection** element to your page
38+
2. Choose which collection to display
39+
3. Design the layout for a single item — the design repeats for each item
40+
4. Bind collection fields to elements inside the list
41+
42+
### Sorting
43+
44+
Control the display order of items:
45+
46+
- **None** — Default database order
47+
- **Manual** — Custom order set by drag-and-drop in the CMS
48+
- **Random** — Shuffled on each page load
49+
- **By field** — Sort by any field (e.g., date, name, price) in ascending or descending order
50+
51+
### Filtering
52+
53+
Add filter conditions to show only items matching specific criteria. You can filter by any collection field using operators appropriate to the field type (text contains, number greater than, date is after, reference is one of, and more).
54+
55+
Filters use group-based logic: conditions within a group are combined with OR, and groups are combined with AND.
56+
57+
See [Filtering & Sorting](/docs/cms/filtering) for the full list of operators and examples.
58+
59+
### Pagination
60+
61+
For large collections, enable pagination to split items across pages:
62+
63+
- **Pages** mode shows previous/next navigation and page info
64+
- **Load More** mode adds a button that appends the next batch
3065

31-
To show multiple items on a single page (e.g., a blog listing), use a **Collection List** element. Configure:
66+
Set the items per page count to control batch size. Pagination respects filters — only matching items are counted.
3267

33-
- Which collection to display
34-
- How many items to show
35-
- Sort order and filters
68+
<Callout type="info" title="Tip">
69+
Combine collection lists with filters, sorting, and pagination to build complete listing pages like blogs, product catalogs, team directories, and event calendars.
70+
</Callout>

content/cms/filtering.mdx

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: Filtering & Sorting
3+
---
4+
5+
import { Callout } from 'nextra/components'
6+
7+
# Filtering & Sorting
8+
9+
You can filter and sort collection items on your pages to build directories, listings, blogs, marketplaces, and other data-driven experiences. Filters reduce the dataset before items render, and sorting controls the display order.
10+
11+
## Adding Filters to a Collection List
12+
13+
Filters are configured on collection layers (Collection List elements). Each filter targets a collection field and applies a condition to include or exclude items.
14+
15+
1. Select a **Collection List** layer on the canvas
16+
2. In the right panel, open the **Filters** section
17+
3. Click **+** to add a filter condition
18+
4. Choose a collection field to filter by
19+
5. Select an operator and enter a value
20+
21+
Filtered items update immediately in the editor preview.
22+
23+
## Filter Operators
24+
25+
Available operators depend on the field type:
26+
27+
### Text Fields
28+
29+
Text, rich text, email, phone, and color fields support:
30+
31+
| Operator | Description |
32+
|----------|-------------|
33+
| **is** | Exact match |
34+
| **is not** | Does not match |
35+
| **contains** | Value includes the text |
36+
| **does not contain** | Value does not include the text |
37+
| **is present** | Field has a value |
38+
| **is empty** | Field has no value |
39+
40+
### Number Fields
41+
42+
| Operator | Description |
43+
|----------|-------------|
44+
| **is** | Equals the number |
45+
| **is not** | Does not equal the number |
46+
| **less than** | Value is below the number |
47+
| **less than or equal** | Value is at or below the number |
48+
| **greater than** | Value is above the number |
49+
| **greater than or equal** | Value is at or above the number |
50+
51+
### Date Fields
52+
53+
| Operator | Description |
54+
|----------|-------------|
55+
| **is** | Matches the date |
56+
| **is before** | Earlier than the date |
57+
| **is after** | Later than the date |
58+
| **is between** | Falls within a date range (requires two values) |
59+
| **is empty** | No date set |
60+
| **is not empty** | Has a date |
61+
62+
### Boolean Fields
63+
64+
| Operator | Description |
65+
|----------|-------------|
66+
| **is** | True or false |
67+
68+
### Reference Fields
69+
70+
Reference and single-asset fields support:
71+
72+
| Operator | Description |
73+
|----------|-------------|
74+
| **is one of** | Matches any of the selected items |
75+
| **is not one of** | Does not match any of the selected items |
76+
| **exists** | Has a linked item |
77+
| **does not exist** | No linked item |
78+
79+
When you use **is one of** or **is not one of**, a multi-select dropdown loads items from the referenced collection so you can pick values directly.
80+
81+
### Multi-Reference Fields
82+
83+
| Operator | Description |
84+
|----------|-------------|
85+
| **is one of** | Contains at least one of the selected items |
86+
| **is not one of** | Contains none of the selected items |
87+
| **contains all of** | Contains every selected item |
88+
| **contains exactly** | Contains only the selected items, no more |
89+
| **item count** | Number of linked items matches a comparison (equals, less than, greater than, etc.) |
90+
| **has items** | At least one linked item |
91+
| **has no items** | No linked items |
92+
93+
## Filter Logic
94+
95+
Filters use a group-based logic system:
96+
97+
- **Conditions within a group** use **OR** logic — an item passes if it matches any condition in the group
98+
- **Groups** use **AND** logic — an item must pass all groups to appear
99+
100+
This lets you build expressive filters. For example, to show products that are "Electronics" or "Books" AND cost less than $50, create two groups: one with category conditions (OR) and one with a price condition.
101+
102+
### Adding Multiple Conditions
103+
104+
To add an **OR** condition within a group, click the **+** button next to "Or" inside the group.
105+
106+
To add an **AND** group, click the **+** button at the top of the Filters panel.
107+
108+
## Sorting
109+
110+
Control the display order of collection items using the sort settings on the collection layer:
111+
112+
| Sort Option | Description |
113+
|-------------|-------------|
114+
| **None** | Default database order |
115+
| **Manual** | Custom order set by drag-and-drop reordering in the CMS |
116+
| **Random** | Randomized order on each page load |
117+
| **Field** | Sort by any collection field in ascending or descending order |
118+
119+
When sorting by a field, you choose the field and the direction (ascending or descending). Common sort fields include date (newest first), name (alphabetical), or price (low to high).
120+
121+
## Pagination
122+
123+
When a collection has many items, enable pagination to split them across pages:
124+
125+
1. Select a Collection List layer
126+
2. In the right panel, find **Pagination**
127+
3. Enable pagination and choose a mode:
128+
129+
| Mode | Description |
130+
|------|-------------|
131+
| **Pages** | Traditional page navigation with previous/next buttons and page info |
132+
| **Load More** | A button that appends the next batch of items |
133+
134+
Set the **items per page** count to control how many items appear at once. Pagination works with filters — only items that pass the filters are counted and paginated.
135+
136+
### Styling Pagination Controls
137+
138+
When pagination is enabled, Ycode generates pagination controls (previous/next buttons, page info text). You can style these controls through the pagination layer settings in the design panel.
139+
140+
<Callout type="info" title="Tip">
141+
Combine filters, sorting, and pagination to build complete listing experiences. For example, a product directory with category filters, price sorting, and 12 items per page.
142+
</Callout>

content/cms/index.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ For listing multiple items on one page, you use **Collection Lists** with sort,
3131

3232
See [Dynamic Pages](/docs/cms/dynamic-pages) for setup and data binding.
3333

34+
## Filtering & Sorting
35+
36+
You can filter and sort collection items directly on your pages. Add conditions to Collection List layers to show only items that match specific criteria — by category, price, date, tags, reference fields, and more. Combine filters with sorting and pagination to build directories, listings, blogs, and marketplaces.
37+
38+
See [Filtering & Sorting](/docs/cms/filtering) for operators, filter logic, and pagination.
39+
3440
## Next Steps
3541

3642
- [Collections](/docs/cms/collections) — Create collections and define fields
3743
- [Items](/docs/cms/items) — Add and manage content
3844
- [Dynamic Pages](/docs/cms/dynamic-pages) — Connect pages to collections and bind data
45+
- [Filtering & Sorting](/docs/cms/filtering) — Filter, sort, and paginate collection items

content/editor/components.mdx

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Components
33
---
44

5+
import { Callout } from 'nextra/components'
56
import { Steps } from 'nextra/components'
67
import { KeyboardShortcut } from '@/components/keyboard-shortcut'
78

@@ -29,13 +30,33 @@ Enter a name in the Create Component dialog. The component is added to your comp
2930

3031
## Component Variables
3132

32-
Components support variables for content that varies per instance:
33+
Components support variables for content that varies per instance. You define variables when creating or editing the component, then link them to layers inside the component. Each instance can override these values without affecting the master or other instances.
3334

34-
- **Text** — Overridable text content
35-
- **Image** — Overridable image source
36-
- **Link** — Overridable link URL
35+
### Variable Types
3736

38-
You define variables when creating or editing the component. Each instance can override these values without affecting the master or other instances.
37+
| Type | Description |
38+
|------|-------------|
39+
| **Text** | Overridable text content, supports rich text formatting (bold, italic, links, inline CMS variables) |
40+
| **Image** | Overridable image source |
41+
| **Link** | Overridable link URL and settings |
42+
| **Audio** | Overridable audio file source |
43+
| **Video** | Overridable video file source |
44+
| **Icon** | Overridable SVG icon |
45+
46+
### Linking Variables to Layers
47+
48+
After creating a variable, link it to a layer inside the component:
49+
50+
1. Enter component edit mode
51+
2. Select the target layer (e.g., a text element, image, or button)
52+
3. In the right panel, find the **Link to variable** option
53+
4. Choose the variable to link
54+
55+
The linked layer displays the variable's default value. Each instance can then override that value.
56+
57+
### Rich Text Variables
58+
59+
Text variables support rich text content. When you override a text variable on an instance, you get the full rich text editor with formatting controls, inline CMS field references, and structured content. This is useful for components like cards, testimonials, or content blocks where the text needs formatting beyond plain strings.
3960

4061
## Editing Components
4162

@@ -55,6 +76,22 @@ Detaching is irreversible. The detached layers are independent copies. You canno
5576

5677
Every placement of a component is an instance. Instances share the same structure and styles as the master. You can override component variables per instance. All instances update when you edit the master.
5778

79+
When components are nested (a component instance inside another component), each level maintains its own overrides independently. The inner component's overrides are scoped to that instance within the parent component's layer tree.
80+
81+
## Components in Rich Text
82+
83+
You can insert component instances inside CMS rich text fields. This lets you create structured, reusable blocks within long-form content — callouts, embeds, feature highlights, pricing cards, and more.
84+
85+
When editing a rich text field in the CMS, use the component inserter to place a component instance inline with your content. The component renders with its full design and structure, and you can override its variables per insertion.
86+
5887
<Callout type="info" title="Tip">
59-
Use components for repeated patterns: headers, footers, cards, buttons, and navigation. Component variables let you customize content while keeping structure and styling consistent.
88+
Components in rich text are ideal for content teams who need consistent design patterns inside blog posts, documentation, or marketing pages without touching the page editor.
6089
</Callout>
90+
91+
## Best Practices
92+
93+
- Use components for repeated patterns: headers, footers, cards, buttons, and navigation
94+
- Define variables for any content that changes between instances
95+
- Use rich text variables when instance content needs formatting
96+
- Nest components to build complex, reusable structures (e.g., a card grid component containing card components)
97+
- Use components in CMS rich text to maintain design consistency across dynamic content

content/forms/builder.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Form elements are layer templates you nest inside the form container:
2828
| **radio** | Single choice from options |
2929
| **label** | Label text for a field |
3030

31+
When you add an input, textarea, select, checkbox, or radio element, Ycode wraps it in a group container with a label. The label uses the semantic `<label>` HTML tag with a `for` attribute that links it to the input, ensuring proper accessibility and allowing users to click the label to focus the field.
32+
3133
## Input Types
3234

3335
The input element supports these types via its settings:

content/forms/index.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ On submit, Ycode can trigger webhooks, send email notifications, and run app int
2121

2222
See [Submissions](/docs/forms/submissions) for viewing, statuses, metadata, and integrations.
2323

24+
## CMS Filtering
25+
26+
Forms can also be used in combination with [Collection Lists](/docs/cms/dynamic-pages#collection-lists) to create filtering and sorting experiences for your visitors. Connect form inputs to collection filters so users can search, filter by category, sort by price, and more — all without page reloads.
27+
28+
See [Filtering & Sorting](/docs/cms/filtering) for details on setting up collection filters.
29+
2430
## Next Steps
2531

2632
- [Form Builder](/docs/forms/builder) — Build forms with the visual editor
2733
- [Submissions](/docs/forms/submissions) — View and manage form responses
34+
- [Filtering & Sorting](/docs/cms/filtering) — Create dynamic filtering for collection lists

0 commit comments

Comments
 (0)