How to Create a Table of Contents for CMS Collections in Framer
Learn How to Create a Custom Table of Contents in Framer.
In this tutorial, you'll learn how to implement a custom table of contents in Framer.
Get the Code from GitHub
Visit my GitHub repository and copy the code from it.
Open Framer, Go to
Assets
and selectNew Code
.Name the code file
TableOfContent
.Paste the code and save it.
Implement the Table of Contents
Select the content you want to include in the table of contents.
Add the code override file named
TableOfContent
and the override function namedwithContent
.
Create Component with Variants
Create a component with six variants: h1, h2, h3, h4, h5, and h6.
Ensure the naming is lowercase (e.g., "h1," "h2").
Create a Link variable for links.
Create a Title variable for the content.
To use the component, you will have to select the component and add the code override file named TableOfContent
and the override function named withTableOfContent
.
Implement Design Changes
In my case, I only want to display the headings h1
and h2
, so I will set the HEADING_TO_DISPLAY
variable as const HEADING_TO_DISPLAY = ["h1", "h2"];
.
Adjust the scroll margin top
If you want to edit the scroll top offset, you will need to modify the SCROLL_MARGIN_TOP
variable. By default, it's set to const SCROLL_MARGIN_TOP = 160
.
Congratulations! You've successfully created a custom table of contents for your CMS collections in Framer.
If you have any questions, don't hesitate to reach out for support.
How to Create a Table of Contents for CMS Collections in Framer
Learn How to Create a Custom Table of Contents in Framer.
In this tutorial, you'll learn how to implement a custom table of contents in Framer.
Get the Code from GitHub
Visit my GitHub repository and copy the code from it.
Open Framer, Go to
Assets
and selectNew Code
.Name the code file
TableOfContent
.Paste the code and save it.
Implement the Table of Contents
Select the content you want to include in the table of contents.
Add the code override file named
TableOfContent
and the override function namedwithContent
.
Create Component with Variants
Create a component with six variants: h1, h2, h3, h4, h5, and h6.
Ensure the naming is lowercase (e.g., "h1," "h2").
Create a Link variable for links.
Create a Title variable for the content.
To use the component, you will have to select the component and add the code override file named TableOfContent
and the override function named withTableOfContent
.
Implement Design Changes
In my case, I only want to display the headings h1
and h2
, so I will set the HEADING_TO_DISPLAY
variable as const HEADING_TO_DISPLAY = ["h1", "h2"];
.
Adjust the scroll margin top
If you want to edit the scroll top offset, you will need to modify the SCROLL_MARGIN_TOP
variable. By default, it's set to const SCROLL_MARGIN_TOP = 160
.
Congratulations! You've successfully created a custom table of contents for your CMS collections in Framer.
If you have any questions, don't hesitate to reach out for support.
How to Create a Table of Contents for CMS Collections in Framer
Learn How to Create a Custom Table of Contents in Framer.
In this tutorial, you'll learn how to implement a custom table of contents in Framer.
Get the Code from GitHub
Visit my GitHub repository and copy the code from it.
Open Framer, Go to
Assets
and selectNew Code
.Name the code file
TableOfContent
.Paste the code and save it.
Implement the Table of Contents
Select the content you want to include in the table of contents.
Add the code override file named
TableOfContent
and the override function namedwithContent
.
Create Component with Variants
Create a component with six variants: h1, h2, h3, h4, h5, and h6.
Ensure the naming is lowercase (e.g., "h1," "h2").
Create a Link variable for links.
Create a Title variable for the content.
To use the component, you will have to select the component and add the code override file named TableOfContent
and the override function named withTableOfContent
.
Implement Design Changes
In my case, I only want to display the headings h1
and h2
, so I will set the HEADING_TO_DISPLAY
variable as const HEADING_TO_DISPLAY = ["h1", "h2"];
.
Adjust the scroll margin top
If you want to edit the scroll top offset, you will need to modify the SCROLL_MARGIN_TOP
variable. By default, it's set to const SCROLL_MARGIN_TOP = 160
.
Congratulations! You've successfully created a custom table of contents for your CMS collections in Framer.
If you have any questions, don't hesitate to reach out for support.
More Tutorials
How to Fix "Unable to Resolve Package" Error in Framer
Learn How to Fix "Unable to Resolve Package" Error in your Framer Project
How to Truncate Text with Framer Code Override
Learn How to use Truncate Text Code Override in your Framer Project.
How to Organize your Framer Components using Folders
Learn How to use Folders to Organize Components in your Framer Project.
How to Center Images in the CMS Content in Framer
Learn How to Center Images in Framer CMS content using a Custom Code Override.
How to use Dynamic Viewports and Relative Units in Framer
Learn How to use Dynamic Viewport units (svh, lvh, dvh) and relative units (vh, vw, vmax, vmin, em, rem) in Framer projects.
How to Track UTM Parameters in Framer Forms
Learn How to Capture and Track UTM Parameters in Framer Forms Using Custom Code Overrides
More Tutorials
How to Fix "Unable to Resolve Package" Error in Framer
Learn How to Fix "Unable to Resolve Package" Error in your Framer Project
How to Truncate Text with Framer Code Override
Learn How to use Truncate Text Code Override in your Framer Project.
How to Organize your Framer Components using Folders
Learn How to use Folders to Organize Components in your Framer Project.
How to Center Images in the CMS Content in Framer
Learn How to Center Images in Framer CMS content using a Custom Code Override.
How to use Dynamic Viewports and Relative Units in Framer
Learn How to use Dynamic Viewport units (svh, lvh, dvh) and relative units (vh, vw, vmax, vmin, em, rem) in Framer projects.
How to Track UTM Parameters in Framer Forms
Learn How to Capture and Track UTM Parameters in Framer Forms Using Custom Code Overrides
More Tutorials
How to Fix "Unable to Resolve Package" Error in Framer
Learn How to Fix "Unable to Resolve Package" Error in your Framer Project
How to Truncate Text with Framer Code Override
Learn How to use Truncate Text Code Override in your Framer Project.
How to Organize your Framer Components using Folders
Learn How to use Folders to Organize Components in your Framer Project.
How to Center Images in the CMS Content in Framer
Learn How to Center Images in Framer CMS content using a Custom Code Override.
How to use Dynamic Viewports and Relative Units in Framer
Learn How to use Dynamic Viewport units (svh, lvh, dvh) and relative units (vh, vw, vmax, vmin, em, rem) in Framer projects.
How to Track UTM Parameters in Framer Forms
Learn How to Capture and Track UTM Parameters in Framer Forms Using Custom Code Overrides
Let's take it to the next level.
Let's take it to the next level.
Let's take it to the next level.