Skip to content

Commit c029f20

Browse files
authored
added snapkit table docs (#40)
* added snap-surface instructions * addded table * revert surfaces * grammar fixes * Update snapkit.mdx * Update snapkit.mdx
1 parent 15cb3a7 commit c029f20

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

fern/docs/pages/references/snapkit.mdx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,115 @@ Inherited from [Snap](#snap):
568568
}
569569
```
570570

571+
### Table
572+
573+
A table element used to present JSON structured data.
574+
575+
#### Properties
576+
577+
- `rows` (required): The values to be displayed in the table. The data should be provided as a JSON object, where each cell is a plaintext SnapKit component.
578+
- `columns` (required): Columns are defined as an array of objects, where each object has two parameters: an optional header and a required field key, which defines which field from rows is shown in the defined column. If a key is not used, it means that the associated data from rows will not be displayed in the table. The order of keys also defines the order in which values from rows are shown in the table.
579+
580+
#### Inherited properties
581+
582+
Inherited from [Snap](#snap):
583+
584+
- `type` (required): The type of the element, should be set to `"table"`.
585+
- `block_id` (optional): A unique identifier for the snap. If not provided, a random ID is generated.
586+
587+
#### Example
588+
589+
![table](https://github.com/starlightknown/blender-portfolio/assets/74637789/65274552-6317-4af9-b04b-c03a651eb412)
590+
591+
```json
592+
{
593+
"elements": [
594+
{
595+
"columns": [
596+
{
597+
"header": {
598+
"text": "Date",
599+
"type": "plain_text"
600+
},
601+
"key": "date"
602+
},
603+
{
604+
"header": {
605+
"text": "Status",
606+
"type": "plain_text"
607+
},
608+
"key": "status"
609+
},
610+
{
611+
"header": {
612+
"text": "Project Title",
613+
"type": "plain_text"
614+
},
615+
"key": "title"
616+
}
617+
],
618+
"rows": [
619+
{
620+
"date": {
621+
"text": "2024-03-04",
622+
"type": "plain_text"
623+
},
624+
"hiddenField": {
625+
"text": "Hidden value",
626+
"type": "plain_text"
627+
},
628+
"status": {
629+
"text": "Completed",
630+
"type": "plain_text"
631+
},
632+
"title": {
633+
"text": "Project A",
634+
"type": "plain_text"
635+
}
636+
},
637+
{
638+
"date": {
639+
"text": "2024-03-05",
640+
"type": "plain_text"
641+
},
642+
"hiddenField": {
643+
"text": "hidden",
644+
"type": "plain_text"
645+
},
646+
"status": {
647+
"text": "In Progress",
648+
"type": "plain_text"
649+
},
650+
"title": {
651+
"text": "Project B",
652+
"type": "plain_text"
653+
}
654+
},
655+
{
656+
"date": {
657+
"text": "2024-03-06",
658+
"type": "plain_text"
659+
},
660+
"hiddenField": {
661+
"text": "hidden",
662+
"type": "plain_text"
663+
},
664+
"status": {
665+
"text": "Pending",
666+
"type": "plain_text"
667+
},
668+
"title": {
669+
"text": "Project C",
670+
"type": "plain_text"
671+
}
672+
}
673+
],
674+
"type": "table"
675+
}
676+
]
677+
}
678+
```
679+
571680
## Form elements
572681

573682
### Plain text option

0 commit comments

Comments
 (0)