CMS
Framer Update: Code Blocks & Inline Code
Framer Update: Code Blocks & Inline Code
Framer Update: Code Blocks & Inline Code
Hunter
·
5:58
·
8.8K views
·
About this lesson
We’re excited to introduce Code Blocks & Inline Code, unlocking the ability to document and present your code in Framer. Get started in the CMS via the Formatted Text Toolbar, showcase your code on the Canvas by finding the Code Block component in the Insert Panel, or type a backtick anywhere for Inline Code. Remix our docs template here: https://standard.framer.wiki/
🌞 Try Framer for free: https://framer.com
🎉 Follow on Twitter: https://twitter.com/framer
💎 Join Community: https://www.framer.community
0:00hey y'all it's hunter in this video I'll0:02show you how you can use the new code0:04blocks and inline code features in0:06framer0:07you can use this to make API0:09documentation alongside your current0:10framer site maybe a password protected0:12docs for your team or just some cool0:15blog posts about code0:17let's start by taking a look at the0:18example site we have here0:20this site is filled with example content0:22to show different options for how you0:25could build your documentation site0:27if you want to follow along in framer or0:29you just want to start playing around0:30for yourself you can find the link to0:32this template in the description0:33now what are these features you've0:36probably seen this around the web before0:37but inline code is used for calling out0:40a piece of code within a block of text0:42and a code block looks more like what0:44you'd expect in a text editor for coding0:46with syntax highlighting and multi-line0:49support0:51let's open the CMS and I'll show you how0:52you can add code to your CMS content0:56if we open up one of our CMS items we'll0:58see there's two new buttons in the rich1:00text toolbar1:02one for inline code and one for code1:04blocks1:05let's start using inline code by calling1:07out the framer Library here which is1:09actually a name that we would use in1:11code so if we select it and click the1:14inline code button we can also use the1:17shortcut command shift C on Mac OS or1:20Ctrl shift C on Windows1:23it now becomes inline code this will1:25make it monospace in the editor and add1:27a slight background so you know you1:28formatted this text1:30in this example content we also want to1:32show what an example component looks1:34like so we'll use a code block for this1:36to do that let's create a new line and1:39we'll click the code block button in the1:41toolbar1:43this instantly inserts a code block we1:46can go ahead and just type whatever code1:47we want right in here1:49and it looks exactly how we'd expect the1:52code to look1:53we can change the language if we need1:55but in this case we'll stick to jsx2:00our code blocks have great inline2:01editing with auto bracket completion and2:04auto indentation but if you have your2:06code on hand already you can just paste2:08it right in and everything will look how2:09you expect with syntax highlighting2:12I'll paste in some code that I have2:13ready2:15alright that's looking good now that2:17we've seen the editing experience let's2:19see what it looks like on our page2:20design2:21if we go to our docs pages2:25there we go you can see that our inline2:27code and our code blocks are showing up2:29on our page2:30now that we've added our formatted code2:32in our content let's take a look at how2:34to style this we can find everything we2:36need in the assets panel under the2:38Styles section2:41both inline code and code blocks are2:43fully customizable to fit whatever your2:45site looks like2:47with the inline code we're able to2:48change many different options like font2:50border radius or border2:53all these controls are designed to be2:55relative to the font size of the2:57surrounding text this allows you to use2:59the size control for instance to set the3:02exact percentage that will make your3:04letter height align with the surrounding3:05text the padding values for the3:08background sizing are also relative to3:10allow you to use the same inline code3:12style for your headings and your body3:14copy to keep things consistent3:17in the Styles section under the CMS3:19category we'll also find the code block3:21Styles in here we can customize3:23everything from the font to the theme to3:26even overriding the background color and3:28setting the radius and the padding3:31and for maximum polish theming is built3:33right in you can select which syntax3:35theme you'd like to use on light mode3:37and which theme you'd like to use on3:39dark mode3:40in this case I'll use the framer light3:41theme and the framer Dark theme but I'll3:44override the background color to fit my3:46design a bit better3:50nice that's looking much better3:52the benefit of having the styling for3:54these in the Styles panel is that I only3:56have to set them up once if I'm writing3:59more content or developer on my team4:01wants to come write some content all4:02they have to worry about is the content4:04and everything will use the styles that4:06are already set on the rich text layer4:09I'll add some more example content to4:10our page using the CMS overlay4:13and you can see that all our content4:15keeps the same style and as a quick tip4:17while I'm doing this any code block4:19content that you copy and paste within4:21the rich text area will retain the4:24language that you copied it from so this4:26pasted block also stays as jsx4:29the styles for code blocks and inline4:31code work just like textiles so you can4:33find them assigned on your Rich Text4:35content in the layers panel you can also4:37create multiple of each of these tiles4:39if you have a bigger site that needs4:40different styles for different text4:42layers in this case let's say we want to4:44make some changes to our Styles so let's4:46hop back into the assets panel and these4:48Styles will apply to each instance of4:50inline code or every code block within4:52this text layer content whether there's4:54three code blocks or 300 allowing you to4:58scale with your content5:00and because framer is a freeform tool5:02we've also added code blocks to the5:04insert menu allowing you to insert them5:06on any page regardless if you're using5:08the CMS or not this is great for5:10creating fully custom landing pages or5:13home pages for your documentation that5:15need to call out pieces of code5:17if we drop it in here we can see we have5:19some example code built in and all the5:22exact same themes that we can use in the5:24CMS allowing us to sync The Styling5:26across our entire website and keep5:28things super consistent5:29it even supports fixed and auto sizing5:32just like any other layer to make it fit5:34to whatever design you may have in mind5:36and that's it for code blocks and inline5:38code and we can't wait to see what you5:40build with this thank you for watching5:42and I will see you next time
More in this topic
Framer Update: CMS 3.0
Framer Update14K views · 1 month ago
Ship websites with enterprise needs, at startup speeds
Announcement8.3M views · 3 months ago
Framer Update: CMS Dynamic Filters
Framer Update14K views · 3 months ago
Framer Update: CMS Components
Framer Update11K views · 4 months ago
Framer Update: Empty States in CMS Lists
Framer Update4K views · 4 months ago
Wireframer: Blogs and Changelogs with CMS
Framer Update5K views · 8 months ago
On-Page Editing in Framer: A powerful new way to update Framer sites, right in the browser.
CMS10K views · 10 months ago
Framer Event — Introducing On-Page Editing
Event12K views · 10 months ago