Figma UI component

Figma code snippet (markdown) components

Code snippets present a block of code for reading and copying, in docs, API references and editor mockups. This Figma component offers three layouts: a line numbered block, a fading block with a show more button, and a tabbed version for multi file examples.
About this component

Code snippet design in Figma: line numbers, tabs, and long files

How these code snippet components are built, and how to fill them with long or multi file examples.

Code blocks are the part of a documentation page people actually read. They also carry the highest stakes of anything on the screen, because a truncated string or a wrapped line in a curl command is a support ticket. Beyond docs they turn up in API references, changelogs, developer marketing pages, the onboarding step that hands over an API key, and in editor mockups where the block is pretending to be an IDE rather than a place to copy from.

Three layouts for three different jobs

The component ships in one 720px width with three types. The Horizontal layout runs a 49px line number gutter down the left of the code, which is the version to use when the surrounding prose refers to a line by number. The Vertical layout drops the gutter and instead fades the block out under a gradient mask across its last 160px, with a 104px show more button sitting in a 68px footer.

Vertical with tabs adds a 36px header holding a row of file tabs, each 28px tall and around 46px wide, plus a utility button of its own. All three keep a pair of 28px utility buttons in the top right of the code area, which is where copy lives and where people look for it.

The tabbed version, and what it is really for

Those tabs are not decoration. They solve the install instruction problem: npm, yarn and pnpm, or Python and Node and Go, all showing the same step. Each tab is its own small component with current, hover and focus states, so a prototype can switch between two package managers convincingly.

Note that these are content switchers inside one block rather than page level horizontal tabs, which is why they sit at 28px and use a compact chip instead of an underline. When there are more than about four languages to show, a select above the block ages better than a row that scrolls.

Typography is most of the work

A code block is a typography component wearing a container. Set a real monospace family, then spend the time on line height and letter spacing, because code is read in vertical columns of indentation as much as in lines. Roughly 1.5 line height keeps nesting legible without spreading a twelve line function across a whole screen.

The other half is color. Syntax highlighting is decorative until it drops below the 4.5:1 contrast ratio for normal text, and the offender is almost always the comment grey on a dark background, the one token designers pick to look subtle and end up making unreadable. The whole file exists in light and dark, which matters more here than elsewhere, because a syntax palette cannot be flipped from one to the other by inverting the greys.

Fill it with code that compiles

Placeholder text is acceptable in a card. It is not acceptable here, because every engineer reviewing the mockup will read the code first and the layout second, and a snippet with mismatched brackets destroys the credibility of the screen it sits on.

Paste something real, keep it under fifteen lines so the block does not need the show more button on its first appearance, and pick an example that shows the shape of the API rather than its simplest possible call. This holds double when the snippet is inside a device mockup in a hero image, where the code is being read at a glance by exactly the audience that will notice.

When it is time to build, Untitled UI React code snippets are open source, built with Tailwind CSS and React Aria, with copy to clipboard and the tab switching already wired.

FAQs

Frequently asked questions

Common questions about the Untitled UI Figma code snippet components, covering line numbers, tabs, and overflow.

What font should I use for a code block in Figma?

A monospace family, and one you can also load on the web, since a snippet that only looks right in the design file is a handoff problem.

Keep the size at or above 14px, let the line height run near 1.5 so indentation stays readable, and leave letter spacing alone. Monospace faces are already spaced for legibility and tightening them undoes the reason you chose one.

How do I add syntax highlighting to code in a Figma design?

Three options, in increasing effort. Color the tokens by hand inside a single text layer, which is fine for a snippet of ten lines. Paste from an editor that copies styled text and clean up what survives. Or run one of the community syntax highlighting plugins, which is the only sane route for a long block.

Whichever you use, check the token colors against the background rather than trusting an editor theme built for a different one.

Should a code snippet show line numbers?

Only when something refers to them. Line numbers help in a tutorial that says to edit line nine, and in an editor mockup where their absence would look wrong. In a copyable install command they are noise, and worse, they get selected along with the code in products that render them as text.

The Horizontal type in this set carries the 49px gutter for the first case; the other two leave it out.

Are these code snippet components included in the free version?

The code snippets are part of the paid Untitled UI Figma kit. See pricing for the full contents.

The 100% free Figma UI kit includes core components from the same system if you want to try it before buying.

Is there a React version of these code snippets?

Yes. Untitled UI React code snippets are open source, built with Tailwind CSS and React Aria, and mirror these Figma layouts.

They include the tabbed version for showing the same command in more than one language.

Figma UI components

Application UI/Dashboard examples

Dashboard, settings, form layouts—useful examples for everything you need to design modern dashboards and products.
Figma UI components

Application UI/Dashboard Figma components

Modals, tables, alerts—everything you need to design modern and beautiful apps, dashboards and products.
Figma UI components

Marketing website components

Landing page header and website sections—everything you need to design modern and responsive marketing websites.
The ultimate UI kit for Figma

What is Untitled UI?

Untitled UI Figma is the largest UI kit and design system for Figma in the world. Here's everything great about Untitled UI in just 60 seconds.
Play icon
Untitled UI in 60 seconds
Play icon
Pause icon
Join 380,000+ designers from the world's top companies
Gumroad 5 stars

Untitled UI is the best $ I've spent on my business in a long time. I'm going to keep using it and recommending it to every designer I know.

Sam Pierce Lolla
Sam Pierce Lolla
Founder, Shuffleboard
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Over the years we've featured hundreds of UI kits on UXCrush, but Untitled UI is by far the most comprehensive and detailed I've seen yet. A must have for any designer!

Luca Vavassori
Luca Vavassori
Founder, UXCrush
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

I've used all UI kits on the market. I can say without a doubt that the Untitled UI kit is the best on the market. It covers everything a designer needs in a modern and efficient way.

Murat Alpay
Murat Alpay
Product Designer, @imuratalpay
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Incredible, and keeps getting better. I’ve tried dozens of UI kits and Untitled UI is the only name you should care about. It stands head and shoulders above the rest.

Jérémy Franck
Jérémy Franck
Designer, @jrmyfranck
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Such a beautiful, detailed, and extensive UI kit. Untitled UI is the perfect foundation for any project. I highly recommend this huge time saver.

Adham Dannaway
Adham Dannaway
Product Designer, Practical UI
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Untitled UI has been an amazing resource that I'm learning to rely upon to spin up ideas in no time. I think I might launch a startup pretty soon by mistake here!

Ricardo Buzzotta
Riccardo Buzzotta
Senior Product Designer, Spotify
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

The sheer scale, details, and organization of this kit is mind-blowing. It covers nearly everything a Designer could need in a modern, efficient and systematic way.

Corey Moen
Corey Moen
Senior Brand Designer, Webflow
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

I'm super impressed with this. I love poking around in other peoples UI Kits to see how they think. This is probably one of the most comprehensive I've seen.

Matt Walker
Matt Walker
Design Systems, Mailchimp
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

I'm super excited to use this for quick mockups of ideas in Figma. We're always trying to streamline our design process so we can move fast! Definitely recommend.

Jenny Chu
Jenny Chu
Head of Product, Eucalyptus
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Untitled UI is easily the best UI kit I've used so far. It has an insane amount of components that are all incredibly well-built. I don't even know how many hours this will save.

Sunny Trochaniak
Sunny Trochaniak
Founder, NewPulse Labs
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

The attention to detail and thought Jordan has put into this UI kit is unparalleled.

Dan Mcleay
Dan Mcleay
Lead Designer, Fox Sports
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

Untitled UI is incredibly well-organized and the attention to detail is great. I highly recommend this kit to any designer that wants to create beautiful designs fast.

Tom Bekkers
Tom Bekkers
Founder & Creative Director, Flowbase
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

What an awesome Figma kit... it's an absolute game changer. This is the perfect base for any design system. The size and attention to detail is next level.

Dan Anisse
Dan Anisse
Co-founder, Relume
Star iconStar iconStar iconStar iconStar icon
Gumroad 5 stars

We've been using Untitled to build Himalayas 2.0 and have finished a complete redesign in just a few days. It has everything we need already pixel-perfect.

Abi Tyas Tunggal
Abi Tyas Tunggal
Co-founder, Himalayas
Star iconStar iconStar iconStar iconStar icon