Code Block
The code-block icon represents a block of code or a code snippet.
Exports at 24 × 24 px
Code
Code Block in your framework
In any framework. Customize it above, and the code follows.
export const CodeBlockIcon = (props: React.SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" {...props}>
<path fill="currentColor" fillRule="evenodd" d="M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3zm5 1a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2zm-8 4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zm4 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2zm-4 4a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2z" clipRule="evenodd"/>
</svg>
);Other libraries
Code Block in 5 more libraries
Each library draws it its own way. Open one to compare.
Majesticons
More like it
Icons that share its tags, in the same style.
Search Majesticons
Skip the copy and paste. With Pro, your AI agent finds and installs any Majesticons icon from a prompt.
Get ProTags
Browse by tag
Code Block is tagged development, software, programming and 3 more. Related tags follow; each opens its icons from every library.
Pricing
Majesticons MCP, with Pro
Ask for Code Block or any of 1,045 Majesticons icons and your agent installs it. The MCP comes with every Pro plan, with 6,000+ blocks and 14 premium templates. The icons stay free.
4.9/5 out of 5 · 150+ reviewsfrom 150+ founders and developers.
- Secure checkout via Stripe
- Code lives in your repo
- Keep what you've shipped if you cancel
- License terms
FAQ
Frequently asked questions
What the Code Block icon means and where it's used, then how to install, style, label and license it.
The code-block icon represents a block of code or a code snippet. It is commonly used in user interfaces to indicate a self-contained piece of code or a code example. This icon is often used in conjunction with other UI elements to provide a clear and intuitive way to access coding or development features. The code-block icon is a variation of the code icon, with a block shape.
In software and platforms, the code-block icon appears in various applications, such as code editors like Visual Studio Code, Sublime Text, and Atom. It is often used to represent a code block or snippet, and to provide access to coding tools.
From a UX perspective, the code-block icon communicates a sense of coding and development to users. It helps users understand that they are accessing a block of code or a code example, and provides a sense of control and agency over their code. The icon's block shape and code symbol also make it easily recognizable and distinguishable from other icons.
Code Block is one of 1,045 icons in Majesticons, made by Gerrit Halfmann and released under MIT. It is drawn on a 24 × 24 grid.
Sign in (it's free), then open Get icon, Install with shadcn CLI, and pick your package manager to copy the command. It adds CodeBlockIcon to components/icons/majesticons-code-block.tsx: one file, a size prop (24 by default) and every SVG prop, with no icon package.
Copy it as React (from Get icon, or the Code section): a typed CodeBlockIcon component you paste into your project, with no package to install. Only the icons you import reach your bundle. It works in Next.js and any React app.
Open Get icon, then Copy as code, and pick Vue, Svelte, Angular, Solid or Preact; the Code section shows each one too. Every version is one self-contained component with the SVG inside, and SVG and data URL copies are there for plain HTML and CSS.
With Pro, the shadcn.io MCP server lets Claude Code, Cursor or any MCP client find the Code Block icon, or any of 1,045 Majesticons icons, and install it from a prompt.
It's drawn in currentColor, so it takes the text color wherever you use it: a class like text-primary recolors it. To bake a color in, set one in Customize before you copy.
Set width and height on the component, or a class like size-6. It's drawn on a 24 × 24 grid, so it stays sharp at any size. Customize also sets the size it exports at, its padding and rotation.
Yes. It follows the text color, so with text-foreground (or any theme token) it changes with your light and dark themes. The icon is a vector, so it needs no separate dark asset.
Next to a visible label it's decoration: add aria-hidden="true" so screen readers skip it. Standing alone, as in an icon button, give the button a name instead, like aria-label="Code Block", so screen readers say what it does.
Yes. CodeBlockIcon passes every SVG prop to the svg element, so <CodeBlockIcon aria-hidden="true" /> works, and so do role="img" with aria-label, or a title child, when it carries meaning on its own.
Yes. Open Get icon, then Download file: SVG for code or design tools like Figma; PNG, WebP or JPEG at 512px; or an ICO favicon with 16, 32 and 48px inside. Each one uses what you set in Customize.
Yes. MIT allows commercial use; keep the license notice when you ship the icons' source files. The full terms are in the license, linked on this page.
No visible credit is required: MIT only asks that you keep the license notice if you ship the icons' source files. Icons installed with the shadcn CLI already start with a comment naming Majesticons, Gerrit Halfmann and the license.
Yes. Copying and downloading it is free, and the shadcn CLI install only needs a free account.
5 other libraries draw an icon called Code Block. The Other libraries section on this page shows each one, so you can compare them and open the one that fits your style.
Its tags are development, software, programming, code, block and snippet. Each tag page lists the icons that carry it from every library, which is the quickest way to find a match for Code Block in another set.
Majesticons draws many icons in several styles: Line next to the default. Open the library and pick a style above the grid to see Code Block's siblings in it.
4.9 out of 5 from 150+ developers
Install Code Block from a prompt
MCP, 6,000+ blocks and 14 premium templates in every Pro plan. The icons stay free.
Get Pro