Sitecore

JSS Styleguide

This is a live set of examples of how to use JSS. For more information on using JSS, please see the documentation.

The content and layout of this page is defined in /data/routes/styleguide/en.yml

Content Data

Single-Line Text

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Text.astro

This is a sample text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a <input type="text">.
This is another sample text field using rendering options. HTML supported with encode=false. Cannot edit because editable=false.
Raw value (not editable): This is a sample text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a <input type="text">.

Multi-Line Text

Multi-line text tells Sitecore to use a textarea for editing; consumption in JSS is the same as single-line text.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Text.astro

This is a sample multi-line text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a textarea.
This is another sample multi-line text field using rendering options. HTML supported with encode=false.
Raw value (not editable): This is a sample multi-line text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a textarea.

Rich Text

Implementation: /src/components/styleguide/Styleguide-FieldUsage-RichText.astro

This is a sample rich text field. HTML is always supported. In Sitecore, editors will see a WYSIWYG editor for these fields.

Another sample rich text field, using options. Keep markup entered in rich text fields as simple as possible - ideally bare tags only (no classes). Adding a wrapping class can help with styling within rich text blocks.

But you can use any valid HTML in a rich text field!

Image

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Image.astro

Plain image

Sitecore Logo

Advanced image

Sitecore JSS Logo

Astro Image

Implementation: /src/components/styleguide/Styleguide-FieldUsage-AstroImage.astro

Plain image

Sitecore Logo

Advanced image

Sitecore JSS Logo

File

Note: Sitecore does not support inline editing of File fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-File.astro

Number

Number tells Sitecore to use a number entry for editing.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Number.astro

1.21

JS value type: number
JS value: 1.21

Checkbox

Note: Sitecore does not support inline editing of Checkbox fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Checkbox.astro

  • checkbox is true
  • checkbox2 is false

Date

Both Date and DateTime field types are available. Choosing DateTime will make Sitecore show editing UI for time; both types store complete date and time values internally. Date values in JSS are formatted using ISO 8601 formatted strings, for example 2012-04-23T18:25:43.511Z.

Note: this is a JavaScript date format (e.g. new Date().toISOString()), and is different from how Sitecore stores date field values internally. Sitecore-formatted dates will not work.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Date.astro

  • Date helper: 2012-05-04T00:00:00Z
  • Date helper (datetime): 2018-03-14T15:00:00Z
  • UTC Date string:  Fri, 04 May 2012 00:00:00 GMT
  • Localized Date string (local timezone):  5/4/2012
  • Localized DateTime string (local timezone):  3/14/2018, 5:00:00 PM

General Link

A General Link is a field that represents an <a> tag.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Link.astro

External link:  Link to Sitecore
Internal link:  HTML or other components can be used within link renderers, for example links to images.
Email link:  Send an Email
All possible content params link:  Sitecore Dev Site
The link component accepts params of its own:  Link to Sitecore

Item Link

Item Links are a way to reference another content item to use data from it. Referenced items may be shared. To reference multiple content items, use a Content List field.
Note: Sitecore does not support inline editing of Item Link fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-ItemLink.astro

Shared Item Link

Field: ItemLink Demo (Shared) Item 1 Text Field

Local Item Link

Field: Referenced item textField

Content List

Content Lists are a way to reference zero or more other content items. Referenced items may be shared. To reference a single content item, use an Item Link field.
Note: Sitecore does not support inline editing of Content List fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-ContentList.astro

Shared Content List

Field: ContentList Demo (Shared) Item 1 Text Field

Field: ContentList Demo (Shared) Item 2 Text Field

Local Content List

Field: Hello World Item 1

Field: Hello World Item 2

Custom Fields

Any Sitecore field type can be consumed by JSS. In this sample we consume the Integer field type.
Note: For field types with complex data, custom FieldSerializers may need to be implemented on the Sitecore side.

Implementation: /src/components/styleguide/Styleguide-FieldUsage-Custom.astro

31337

Layout Patterns

Reusing Content

JSS provides powerful options to reuse content, whether it's sharing a common piece of text across pages or sketching out a site with repeating lorem ipsum content.

Implementation: /src/components/styleguide/Styleguide-Layout-Reuse.astro

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.

Mix and match reused and local content. Check out /data/routes/styleguide/en.yml to see how.

Tabs

Creating hierarchical components like tabs is made simpler in JSS because it's easy to introspect the layout structure.

Implementation: /src/components/styleguide/Styleguide-Layout-Tabs.astro

Implementation: /src/components/styleguide/Styleguide-Layout-Tabs-Tab.astro

Tab 1 contents!

Implementation: /src/components/styleguide/Styleguide-Layout-Tabs-Tab.astro

Tab 2 contents!

Implementation: /src/components/styleguide/Styleguide-Layout-Tabs-Tab.astro

Tab 3 contents!

Sitecore Patterns

Sitecore Context

The Sitecore Context contains route-level data about the current context - for example, pageState enables conditionally executing code based on whether Sitecore is in Experience Editor or not.

Implementation: /src/components/styleguide/Styleguide-SitecoreContext.astro

The current Sitecore Context is...

{
  "pageEditing": false,
  "site": {
    "name": "astro"
  },
  "pageState": "normal",
  "language": "en",
  "itemPath": "/styleguide",
  "route": {
    "name": "styleguide",
    "displayName": "styleguide",
    "fields": {
      "pageTitle": {
        "value": "Styleguide | Sitecore JSS"
      }
    },
    "databaseName": "master",
    "deviceId": "fe5d7fdf-89c0-4d99-9aa3-b5fbd009c9f3",
    "itemId": "e7d35297-8079-5fc5-8ae1-83d972fa6bb7",
    "itemLanguage": "en",
    "itemVersion": 1,
    "layoutId": "aafff035-f506-4549-8e0a-d933f2e256c8",
    "templateId": "a3a87cb0-f4b2-591e-8823-ea73bb367bcd",
    "templateName": "App Route",
    "placeholders": {
      "jss-main": [
        {
          "uid": "e02ddb9b-a062-5e50-924a-1940d7e053ce",
          "componentName": "ContentBlock",
          "dataSource": "{51E61710-2EAA-5E05-9177-A39469FB48EC}",
          "fields": {
            "heading": {
              "value": "JSS Styleguide"
            },
            "content": {
              "value": "<p>This is a live set of examples of how to use JSS. For more information on using JSS, please see <a href=\"https://jss.sitecore.com\" target=\"_blank\" rel=\"noopener noreferrer\">the documentation</a>.</p>\r\n<p>The content and layout of this page is defined in <code>/data/routes/styleguide/en.yml</code></p>\r\n"
            }
          }
        },
        {
          "uid": "34a6553c-81de-5cd3-989e-853f6cb6df8c",
          "componentName": "Styleguide-Layout",
          "dataSource": "",
          "placeholders": {
            "jss-styleguide-layout": [
              {
                "uid": "b7c779da-2b75-586c-b40d-081fcb864256",
                "componentName": "Styleguide-Section",
                "dataSource": "{038EFDFD-D6A9-5B88-A863-D11700FE6DA5}",
                "fields": {
                  "heading": {
                    "value": "Content Data"
                  }
                },
                "placeholders": {
                  "jss-styleguide-section": [
                    {
                      "uid": "63b0c99e-dac7-5670-9d66-c26a78000eae",
                      "componentName": "Styleguide-FieldUsage-Text",
                      "dataSource": "{20345802-5ADB-52D8-BFF6-83E66BF736FA}",
                      "fields": {
                        "sample": {
                          "value": "This is a sample text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a <input type=\"text\">."
                        },
                        "sample2": {
                          "value": "This is another sample text field using rendering options. <mark>HTML supported with encode=false.</mark> Cannot edit because editable=false."
                        },
                        "heading": {
                          "value": "Single-Line Text"
                        },
                        "description": {
                          "value": ""
                        }
                      }
                    },
                    {
                      "uid": "f1ea3bb5-1175-5055-ab11-9c48bf69427a",
                      "componentName": "Styleguide-FieldUsage-Text",
                      "dataSource": "{AC76F714-4453-563D-919B-1AC6A23A8E1C}",
                      "fields": {
                        "sample": {
                          "value": "This is a sample multi-line text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a textarea."
                        },
                        "sample2": {
                          "value": "This is another sample multi-line text field using rendering options. <mark>HTML supported with encode=false.</mark>"
                        },
                        "heading": {
                          "value": "Multi-Line Text"
                        },
                        "description": {
                          "value": "<small>Multi-line text tells Sitecore to use a <code>textarea</code> for editing; consumption in JSS is the same as single-line text.</small>"
                        }
                      }
                    },
                    {
                      "uid": "69cebc00-446b-5141-ad1e-450b8d6ee0ad",
                      "componentName": "Styleguide-FieldUsage-RichText",
                      "dataSource": "{4E28154F-9AB7-57F4-ABF8-49278B477122}",
                      "fields": {
                        "sample": {
                          "value": "<p>This is a sample rich text field. <mark>HTML is always supported.</mark> In Sitecore, editors will see a WYSIWYG editor for these fields.</p>"
                        },
                        "sample2": {
                          "value": "<p>Another sample rich text field, using options. Keep markup entered in rich text fields as simple as possible - ideally bare tags only (no classes). Adding a wrapping class can help with styling within rich text blocks.</p>\r\n<marquee>But you can use any valid HTML in a rich text field!</marquee>\r\n"
                        },
                        "heading": {
                          "value": "Rich Text"
                        },
                        "description": {
                          "value": ""
                        }
                      }
                    },
                    {
                      "uid": "d83e8ce9-98f2-499b-bab8-41b5a9d89294",
                      "componentName": "Styleguide-FieldUsage-Image",
                      "dataSource": "/sitecore/content/Headless/Astro/home/styleguide/Page Data/Styleguide-FieldUsage-Image-4",
                      "fields": {
                        "sample1": {
                          "value": {
                            "src": "https://astro.headless.localhost/-/media/Project/Headless/Astro/data/media/img/sc_logo.png?h=51&iar=0&w=204&hash=B6413A92C4BF91B8098626472D255279",
                            "alt": "Sitecore Logo",
                            "width": "204",
                            "height": "51"
                          }
                        },
                        "sample2": {
                          "value": {
                            "src": "https://astro.headless.localhost/-/media/Project/Headless/Astro/data/media/img/jss_logo.png?h=160&iar=0&w=300&hash=891FFB326B613CBC9EB58FF3B57E3C40",
                            "alt": "Sitecore JSS Logo",
                            "width": "300",
                            "height": "160"
                          }
                        },
                        "heading": {
                          "value": "Image"
                        },
                        "description": {
                          "value": ""
                        }
                      }
                    },
                    {
                      "uid": "5630c0e6-0430-5f6a-af9e-2d09d600a386",
                      "componentName": "Styleguide-FieldUsage-AstroImage",
                      "dataSource": "{42146774-69D2-5E6D-B0D4-B392402B7F38}",
                      "fields": {
                        "sample1": {
                          "value": {
                            "src": "https://astro.headless.localhost/-/media/Project/Headless/Astro/data/media/img/sc_logo.png?h=51&iar=0&w=204&hash=B6413A92C4BF91B8098626472D255279",
                            "alt": "Sitecore Logo",
                            "width": "204",
                            "height": "51"
                          }
                        },
                        "sample2": {
                          "value": {
                            "src": "https://astro.headless.localhost/-/media/Project/Headless/Astro/data/media/img/jss_logo.png?h=160&iar=0&w=300&hash=891FFB326B613CBC9EB58FF3B57E3C40",
                            "alt": "Sitecore JSS Logo",
                            "width": "300",
                            "height": "160"
                          }
                        },
                        "heading": {
                          "value": "Astro Image"
                        },
                        "description": {
                          "value": ""
                        }
                      }
                    },
                    {
                      "uid": "bad43ef7-8940-504d-a09b-976c17a9a30c",
                      "componentName": "Styleguide-FieldUsage-File",
                      "dataSource": "{FF8D5E06-4896-5DFE-A06D-D74A084A64F2}",
                      "fields": {
                        "file": {
                          "value": {
                            "src": "https://astro.headless.localhost/-/media/Project/Headless/Astro/data/media/files/jss.pdf",
                            "name": "jss",
                            "displayName": "jss",
                            "title": "Example File",
                            "keywords": "",
                            "description": "This data will be added to the Sitecore Media Library on import",
                            "extension": "pdf",
                            "mimeType": "application/pdf",
                            "size": "156897"
                          }
                        },
                        "heading": {
                          "value": "File"
                        },
                        "description": {
                          "value": "<small>Note: Sitecore does not support inline editing of File fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.</small>\r\n"
                        }
                      }
                    },
                    {
                      "uid": "ff90d4bd-e50d-5bbf-9213-d25968c9ae75",
                      "componentName": "Styleguide-FieldUsage-Number",
                      "dataSource": "{FB0CFF0E-3A20-5F24-A883-C733CCA2B992}",
                      "fields": {
                        "sample": {
                          "value": 1.21
                        },
                        "heading": {
                          "value": "Number"
                        },
                        "description": {
                          "value": "<small>Number tells Sitecore to use a number entry for editing.</small>"
                        }
                      }
                    },
                    {
                      "uid": "b5c1c74a-a81d-59b2-85d8-09bc109b1f70",
                      "componentName": "Styleguide-FieldUsage-Checkbox",
                      "dataSource": "{2DF47286-D7B6-5870-8844-3225BC486102}",
                      "fields": {
                        "checkbox2": {
                          "value": false
                        },
                        "checkbox": {
                          "value": true
                        },
                        "heading": {
                          "value": "Checkbox"
                        },
                        "description": {
                          "value": "<small>Note: Sitecore does not support inline editing of Checkbox fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.</small>\r\n"
                        }
                      }
                    },
                    {
                      "uid": "f166a7d6-9ec8-5c53-b825-33405db7f575",
                      "componentName": "Styleguide-FieldUsage-Date",
                      "dataSource": "{7C35A9D6-5269-5D6B-9E18-AD8A87C79BA7}",
                      "fields": {
                        "date": {
                          "value": "2012-05-04T00:00:00Z"
                        },
                        "dateTime": {
                          "value": "2018-03-14T15:00:00Z"
                        },
                        "heading": {
                          "value": "Date"
                        },
                        "description": {
                          "value": "<p><small>Both <code>Date</code> and <code>DateTime</code> field types are available. Choosing <code>DateTime</code> will make Sitecore show editing UI for time; both types store complete date and time values internally. Date values in JSS are formatted using <a href=\"https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations\" target=\"_blank\">ISO 8601 formatted strings</a>, for example <code>2012-04-23T18:25:43.511Z</code>.</small></p>\r\n<div class=\"alert alert-warning\"><small>Note: this is a JavaScript date format (e.g. <code>new Date().toISOString()</code>), and is different from how Sitecore stores date field values internally. Sitecore-formatted dates will not work.</small></div>\r\n"
                        }
                      }
                    },
                    {
                      "uid": "56a9562a-6813-579b-8ed2-fddab1bfd3d2",
                      "componentName": "Styleguide-FieldUsage-Link",
                      "dataSource": "{9E5E464C-33BB-5DCB-8EEF-750D9E84B931}",
                      "fields": {
                        "emailLink": {
                          "value": {
                            "href": "mailto:foo@bar.com",
                            "linktype": "mailto",
                            "text": "Send an Email",
                            "url": "mailto:foo@bar.com"
                          }
                        },
                        "externalLink": {
                          "value": {
                            "href": "https://www.sitecore.com",
                            "linktype": "external",
                            "text": "Link to Sitecore",
                            "url": "https://www.sitecore.com"
                          }
                        },
                        "internalLink": {
                          "value": {
                            "text": "",
                            "anchor": "",
                            "linktype": "internal",
                            "class": "",
                            "title": "",
                            "target": "",
                            "querystring": "",
                            "id": "{7B4913AE-F499-5976-BDB3-58517D48A67E}",
                            "href": "/"
                          }
                        },
                        "paramsLink": {
                          "value": {
                            "href": "https://dev.sitecore.net",
                            "class": "fw-bold",
                            "target": "_blank",
                            "title": "<a> title attribute",
                            "linktype": "external",
                            "text": "Sitecore Dev Site",
                            "url": "https://dev.sitecore.net"
                          }
                        },
                        "heading": {
                          "value": "General Link"
                        },
                        "description": {
                          "value": "<p>A <em>General Link</em> is a field that represents an <code>&lt;a&gt;</code> tag.</p>"
                        }
                      }
                    },
                    {
                      "uid": "a44ad1f8-0582-5248-9df9-52429193a68b",
                      "componentName": "Styleguide-FieldUsage-ItemLink",
                      "dataSource": "{5DE52D6B-0A61-5E03-86C8-5E6540626446}",
                      "fields": {
                        "localItemLink": {
                          "id": "e4dd8ec1-ebd7-5332-af9b-8cf7220e0295",
                          "url": "/styleguide/Page-Data/styleguide-jss-styleguide-section-B73482E131E5A083D77A50554BC74A4758E29636DF6824F6E2F272EE778C28A095/styleguide-jss-styleguide-section-B75151F05CFDC4CAFFE44E5BAED9D59BEA82565EC11CE75B7DEF3634495EC1DAB7",
                          "name": "styleguide-jss-styleguide-section-B75151F05CFDC4CAFFE44E5BAED9D59BEA82565EC11CE75B7DEF3634495EC1DAB7",
                          "displayName": "Styleguide-FieldUsage-ItemLink-10-item-0",
                          "fields": {
                            "textField": {
                              "value": "Referenced item textField"
                            }
                          }
                        },
                        "sharedItemLink": {
                          "id": "2d5d5db2-8cf6-5450-95a4-a2c023b4ff05",
                          "url": "/Content/Styleguide/ItemLinkField/Item1",
                          "name": "Item1",
                          "displayName": "Styleguide Item Link Item 1 (Shared)",
                          "fields": {
                            "textField": {
                              "value": "ItemLink Demo (Shared) Item 1 Text Field"
                            }
                          }
                        },
                        "heading": {
                          "value": "Item Link"
                        },
                        "description": {
                          "value": "<p>\r\n  <small>\r\n    Item Links are a way to reference another content item to use data from it.\r\n    Referenced items may be shared.\r\n    To reference multiple content items, use a <em>Content List</em> field.<br />\r\n    <strong>Note:</strong> Sitecore does not support inline editing of Item Link fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.\r\n  </small>\r\n</p>\r\n"
                        }
                      }
                    },
                    {
                      "uid": "2f609d40-8ad9-540e-901e-23aa2600f3eb",
                      "componentName": "Styleguide-FieldUsage-ContentList",
                      "dataSource": "{B1F21BC6-4000-5F9E-8BCE-9E01EAF8864A}",
                      "fields": {
                        "localContentList": [
                          {
                            "id": "f7fc43d4-b3ec-550d-b2fd-401787a0f2a8",
                            "url": "/styleguide/Page-Data/styleguide-jss-styleguide-section-B7985C8DEA10AB2C5CC77ABC90CF4126F21840592E09B2C6DB07D84D314CDCE0D4/styleguide-jss-styleguide-section-B7BF1F3509A82A38C71B36F25C4E58E2D04EC965C308A1147E993853137210F241",
                            "name": "styleguide-jss-styleguide-section-B7BF1F3509A82A38C71B36F25C4E58E2D04EC965C308A1147E993853137210F241",
                            "displayName": "Styleguide-FieldUsage-ContentList-11-item-0",
                            "fields": {
                              "textField": {
                                "value": "Hello World Item 1"
                              }
                            }
                          },
                          {
                            "id": "d80fb03a-0229-5e3b-9e22-caf1b9d880c5",
                            "url": "/styleguide/Page-Data/styleguide-jss-styleguide-section-B7985C8DEA10AB2C5CC77ABC90CF4126F21840592E09B2C6DB07D84D314CDCE0D4/styleguide-jss-styleguide-section-B76CB8FB6A660296D91AE50FD7559AF62453A1891C9828A22C84E7E2A9914E7DD8",
                            "name": "styleguide-jss-styleguide-section-B76CB8FB6A660296D91AE50FD7559AF62453A1891C9828A22C84E7E2A9914E7DD8",
                            "displayName": "Styleguide-FieldUsage-ContentList-11-item-1",
                            "fields": {
                              "textField": {
                                "value": "Hello World Item 2"
                              }
                            }
                          }
                        ],
                        "sharedContentList": [
                          {
                            "id": "179431e1-53ed-5b7d-aaf4-dbcf826ff55e",
                            "url": "/Content/Styleguide/ContentListField/Item1",
                            "name": "Item1",
                            "displayName": "Styleguide Content List Item 1 (Shared)",
                            "fields": {
                              "textField": {
                                "value": "ContentList Demo (Shared) Item 1 Text Field"
                              }
                            }
                          },
                          {
                            "id": "f9702c27-170b-5e97-ab61-933333961539",
                            "url": "/Content/Styleguide/ContentListField/Item2",
                            "name": "Item2",
                            "displayName": "Styleguide Content List Item 2 (Shared)",
                            "fields": {
                              "textField": {
                                "value": "ContentList Demo (Shared) Item 2 Text Field"
                              }
                            }
                          }
                        ],
                        "heading": {
                          "value": "Content List"
                        },
                        "description": {
                          "value": "<p>\r\n  <small>\r\n    Content Lists are a way to reference zero or more other content items.\r\n    Referenced items may be shared.\r\n    To reference a single content item, use an <em>Item Link</em> field.<br />\r\n    <strong>Note:</strong> Sitecore does not support inline editing of Content List fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.\r\n  </small>\r\n</p>\r\n"
                        }
                      }
                    },
                    {
                      "uid": "352ed63d-796a-5523-89f5-9a991dda4a8f",
                      "componentName": "Styleguide-FieldUsage-Custom",
                      "dataSource": "{8A02FEE3-E557-52E5-9813-685E341586A6}",
                      "fields": {
                        "customIntField": {
                          "value": 31337
                        },
                        "heading": {
                          "value": "Custom Fields"
                        },
                        "description": {
                          "value": "<p>\r\n  <small>\r\n    Any Sitecore field type can be consumed by JSS.\r\n    In this sample we consume the <em>Integer</em> field type.<br />\r\n    <strong>Note:</strong> For field types with complex data, custom <code>FieldSerializer</code>s may need to be implemented on the Sitecore side.\r\n  </small>\r\n</p>\r\n"
                        }
                      }
                    }
                  ]
                }
              },
              {
                "uid": "7de41a1a-24e4-5963-8206-3bb0b7d9dd69",
                "componentName": "Styleguide-Section",
                "dataSource": "{4A372F38-8C59-5F6C-8B76-E51DA27EF55D}",
                "fields": {
                  "heading": {
                    "value": "Layout Patterns"
                  }
                },
                "placeholders": {
                  "jss-styleguide-section": [
                    {
                      "uid": "3a5d9c50-d8c1-5a12-8da8-5d56c2a5a69a",
                      "componentName": "Styleguide-Layout-Reuse",
                      "dataSource": "{783FBDD2-81F1-5EFC-A64B-717026412484}",
                      "fields": {
                        "heading": {
                          "value": "Reusing Content"
                        },
                        "description": {
                          "value": "<p>JSS provides powerful options to reuse content, whether it's sharing a common piece of text across pages or sketching out a site with repeating <em>lorem ipsum</em> content.</p>"
                        }
                      },
                      "placeholders": {
                        "jss-reuse-example": [
                          {
                            "uid": "aa328b8a-d6e1-5b37-8143-250d2e93d6b8",
                            "componentName": "ContentBlock",
                            "dataSource": "{FBB4448A-0AC7-5284-BCFB-0A4FCB437F90}",
                            "fields": {
                              "heading": {
                                "value": ""
                              },
                              "content": {
                                "value": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.</p>"
                              }
                            }
                          },
                          {
                            "uid": "c4330d34-623c-556c-bf4c-97c93d40fb1e",
                            "componentName": "ContentBlock",
                            "dataSource": "{FBB4448A-0AC7-5284-BCFB-0A4FCB437F90}",
                            "fields": {
                              "heading": {
                                "value": ""
                              },
                              "content": {
                                "value": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.</p>"
                              }
                            }
                          },
                          {
                            "uid": "a42d8b1c-193d-5627-9130-f7f7f87617f1",
                            "componentName": "ContentBlock",
                            "dataSource": "{E42C3697-DE6A-5907-905B-BC0C6B35F0D1}",
                            "fields": {
                              "heading": {
                                "value": ""
                              },
                              "content": {
                                "value": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.</p>"
                              }
                            }
                          },
                          {
                            "uid": "0f4cb47a-979e-5139-b50b-a8e40c73c236",
                            "componentName": "ContentBlock",
                            "dataSource": "{3A1D2B4C-8358-5345-B57C-C3162E4ECA69}",
                            "fields": {
                              "heading": {
                                "value": ""
                              },
                              "content": {
                                "value": "<p>Mix and match reused and local content. Check out <code>/data/routes/styleguide/en.yml</code> to see how.</p>"
                              }
                            }
                          }
                        ]
                      }
                    },
                    {
                      "uid": "538e4831-f157-50bb-ac74-277fcac9fddb",
                      "componentName": "Styleguide-Layout-Tabs",
                      "dataSource": "{7DE1CB19-8C0B-5413-B7F8-36DC9E218E96}",
                      "fields": {
                        "heading": {
                          "value": "Tabs"
                        },
                        "description": {
                          "value": "<p>Creating hierarchical components like tabs is made simpler in JSS because it's easy to introspect the layout structure.</p>"
                        }
                      },
                      "placeholders": {
                        "jss-tabs": [
                          {
                            "uid": "7ecb2ed2-ac9b-58d1-8365-10ca74824af7",
                            "componentName": "Styleguide-Layout-Tabs-Tab",
                            "dataSource": "{EB9CA57D-3683-559F-BE60-DB8996F1790E}",
                            "fields": {
                              "content": {
                                "value": "<p>Tab 1 contents!</p>"
                              },
                              "title": {
                                "value": "Tab 1"
                              }
                            }
                          },
                          {
                            "uid": "afd64900-0a61-50eb-a674-a7a884e0d496",
                            "componentName": "Styleguide-Layout-Tabs-Tab",
                            "dataSource": "{8ABD775C-193E-5305-8593-5512FE9B13CC}",
                            "fields": {
                              "content": {
                                "value": "<p>Tab 2 contents!</p>"
                              },
                              "title": {
                                "value": "Tab 2"
                              }
                            }
                          },
                          {
                            "uid": "44c12983-3a84-5462-84c0-6ca1430050c8",
                            "componentName": "Styleguide-Layout-Tabs-Tab",
                            "dataSource": "{B7DF51E3-D278-5023-94EC-E1BAAAE3893D}",
                            "fields": {
                              "content": {
                                "value": "<p>Tab 3 contents!</p>"
                              },
                              "title": {
                                "value": "Tab 3"
                              }
                            }
                          }
                        ]
                      }
                    }
                  ]
                }
              },
              {
                "uid": "2d806c25-dd46-51e3-93de-63cf9035122c",
                "componentName": "Styleguide-Section",
                "dataSource": "{FB94644B-2DDC-55F3-9E8B-98565C4F0161}",
                "fields": {
                  "heading": {
                    "value": "Sitecore Patterns"
                  }
                },
                "placeholders": {
                  "jss-styleguide-section": [
                    {
                      "uid": "471fa16a-bb82-5c42-9c95-e7eab1e3bd30",
                      "componentName": "Styleguide-SitecoreContext",
                      "dataSource": "{8E4A28AC-2A6B-5F6B-920E-6D08F2F74FB2}",
                      "fields": {
                        "heading": {
                          "value": "Sitecore Context"
                        },
                        "description": {
                          "value": "<p><small>The Sitecore Context contains route-level data about the current context - for example, <code>pageState</code> enables conditionally executing code based on whether Sitecore is in Experience Editor or not.</small></p>"
                        }
                      }
                    },
                    {
                      "uid": "21f21053-8f8a-5436-bc79-e674e246a2fc",
                      "componentName": "Styleguide-RouteFields",
                      "dataSource": "{F5AEB7BE-45D7-55FC-80B7-5F0A20B93D48}",
                      "fields": {
                        "heading": {
                          "value": "Route-level Fields"
                        },
                        "description": {
                          "value": "<p><small>Route-level content fields are defined on the <em>route</em> instead of on a <em>component</em>. This allows multiple components to share the field data on the same route - and querying is much easier on route level fields, making <em>custom route types</em> ideal for filterable/queryable data such as articles.</small></p>"
                        }
                      }
                    },
                    {
                      "uid": "a0a66136-c21f-52e8-a2ea-f04dcfa6a027",
                      "componentName": "Styleguide-ComponentParams",
                      "dataSource": "{268489F4-6893-57BE-B93A-BD28420B9805}",
                      "params": {
                        "cssClass": "alert alert-success",
                        "columns": "5",
                        "useCallToAction": "true"
                      },
                      "fields": {
                        "heading": {
                          "value": "Component Params"
                        },
                        "description": {
                          "value": "<p><small>Component params (also called Rendering Parameters) allow storing non-content parameters for a component. These params should be used for more technical options such as CSS class names or structural settings.</small></p>"
                        }
                      }
                    }
                  ]
                }
              },
              {
                "uid": "66af8f03-0b52-5425-a6af-6fb54f2d64d9",
                "componentName": "Styleguide-Section",
                "dataSource": "{E12D2A26-A450-5623-B1BB-9ECB054CDE13}",
                "fields": {
                  "heading": {
                    "value": "Multilingual Patterns"
                  }
                },
                "placeholders": {
                  "jss-styleguide-section": [
                    {
                      "uid": "cf1b5d2b-c949-56e7-9594-66afaceaca9d",
                      "componentName": "Styleguide-Multilingual",
                      "dataSource": "{E53CC70B-9532-5242-BF75-4486B8E3DB6A}",
                      "fields": {
                        "sample": {
                          "value": "This text can be translated in en.yml"
                        },
                        "heading": {
                          "value": "Translation Patterns"
                        },
                        "description": {
                          "value": ""
                        }
                      }
                    }
                  ]
                }
              },
              {
                "uid": "2f510a65-174b-55b0-be5a-42f223a1d30a",
                "componentName": "Styleguide-Section",
                "dataSource": "{4B1B7B0B-24C8-5C1F-94A9-4CC462996214}",
                "fields": {
                  "heading": {
                    "value": "Editing"
                  }
                },
                "placeholders": {
                  "jss-styleguide-section": [
                    {
                      "uid": "727fd742-c75d-5f49-b108-5595e9257c0e",
                      "componentName": "Styleguide-EditFrame",
                      "dataSource": "{2C9152C3-C644-59DD-A1CE-585531BAA31D}",
                      "fields": {
                        "applyRedToText": {
                          "value": false
                        },
                        "description": {
                          "value": "<p>Who framed Roger Rabbit? Hard to say. <br /> But JSS now allows to edit frame any piece of content on a page in editing mode. <br /> You can add web edit or field edit buttons, modify edit frame style through CSS class and put the frame wherever you need it. </p>"
                        },
                        "heading": {
                          "value": "Edit Frame"
                        },
                        "sampleList": [
                          {
                            "id": "bfeb639c-c5cf-5775-b17f-f7ea8fa8702e",
                            "url": "/Content/Styleguide/EditFrameDemo/Item1",
                            "name": "Item1",
                            "displayName": "EditFrame Demo List Item 1",
                            "fields": {
                              "title": {
                                "value": "Edit Frame Demo List Item 1"
                              }
                            }
                          },
                          {
                            "id": "f31eb77e-6f89-53c3-b1d9-03e29172be25",
                            "url": "/Content/Styleguide/EditFrameDemo/Item2",
                            "name": "Item2",
                            "displayName": "EditFrame Demo List Item 2",
                            "fields": {
                              "title": {
                                "value": "Edit Frame Demo List Item 2"
                              }
                            }
                          }
                        ]
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  },
  "itemId": "e7d35297-8079-5fc5-8ae1-83d972fa6bb7"
}

Route-level Fields

Route-level content fields are defined on the route instead of on a component. This allows multiple components to share the field data on the same route - and querying is much easier on route level fields, making custom route types ideal for filterable/queryable data such as articles.

Implementation: /src/components/styleguide/Styleguide-RouteFields.astro

Route level pageTitle field: Styleguide | Sitecore JSS

Sample of using a custom route type

Component Params

Component params (also called Rendering Parameters) allow storing non-content parameters for a component. These params should be used for more technical options such as CSS class names or structural settings.

Implementation: /src/components/styleguide/Styleguide-ComponentParams.astro

The CSS class of this paragraph (alert alert-success) is set using a param

useCallToAction param: true
param type: string
the call to action is shown

columns param: 5

Column 0
Column 1
Column 2
Column 3
Column 4

Multilingual Patterns

Translation Patterns

Implementation: /src/components/styleguide/Styleguide-Multilingual.astro

This text can be translated in en.yml

This is a static dictionary entry from /data/dictionary :  This is a dictionary entry in English as a demonstration

Show in English
Show in da-DK

The current language is: en

Editing

Edit Frame

Who framed Roger Rabbit? Hard to say.
But JSS now allows to edit frame any piece of content on a page in editing mode.
You can add web edit or field edit buttons, modify edit frame style through CSS class and put the frame wherever you need it.

Implementation: /src/components/styleguide/Styleguide-EditFrame.astro

This is the content that will be wrapped by edit frame in Experience Editor.
Try out the custom webedit buttons for a variety of tasks like executing javascript, or webedit commands.
Or use field edit buttons to author fields that are not usually editable in Experience Editor.

This text will change color. Use the field edit button to change its appearance

This list can be changed via field editor:
  • Edit Frame Demo List Item 1
  • Edit Frame Demo List Item 2