Skip to content

Blocks

Blocks are the building elements of an email. The editor ships with 43 pre-built blocks across three categories.

Layout Blocks (6)

Layout blocks define the structural grid of your email using MJML sections and columns.

BlockDescriptionMJML Output
1 ColumnSingle full-width columnmj-section > mj-column
2 ColumnsTwo equal columns (50/50)mj-section > 2x mj-column
3 ColumnsThree equal columns (33/33/33)mj-section > 3x mj-column
4 ColumnsFour equal columns (25 each)mj-section > 4x mj-column
Sidebar Left33/67 splitmj-section > 2x mj-column
Sidebar Right67/33 splitmj-section > 2x mj-column

Content Blocks (7)

Content blocks are the individual elements you place inside columns.

BlockDescriptionMJML Tag
TextRich text with inline editingmj-text
ImageImage with URL, alt, and linkmj-image
ButtonStyled CTA buttonmj-button
DividerHorizontal line separatormj-divider
SpacerVertical whitespacemj-spacer
SocialSocial media icon linksmj-social
HeroFull-width hero with background imagemj-hero

Composite Blocks (30)

Composite blocks are pre-designed combinations of layout + content. They're complete sections ready to use.

BlockWhat It Creates
HeaderLogo centered in a section
Header + NavLogo with navigation links
Hero BannerFull-width hero with title, subtitle, and CTA
Hero GradientHero with gradient background
Image + TextTwo-column: image left, text right
Text + ImageTwo-column: text left, image right
CTACentered call-to-action section
Image Grid2x2 image gallery
FeaturesThree-column feature highlights with icons
TestimonialQuote with author name and photo
PricingThree-tier pricing table
Promo CodePromotional code with dashed border
VideoVideo placeholder with play button
SocialSocial media links section
FooterFull footer with links and legal text
Simple FooterMinimal unsubscribe footer
SeparatorDecorative section separator
Product CardProduct image, title, price, and CTA
NotificationAlert/notification banner
StatisticsThree-column stat highlights
AnnouncementAnnouncement banner
StepsNumbered step-by-step process
OrderOrder summary table
FAQQuestion and answer pairs
TeamTeam member cards
CountdownEvent countdown display
ReviewStar rating with testimonial
Mobile AppApp download buttons (iOS + Android)

Using Blocks Programmatically

Node Factories

Create nodes in code using the factory functions:

ts
import {
  createText,
  createImage,
  createButton,
  createSection,
  createColumn,
  createDivider,
  createSpacer,
  createSocial,
  createHero,
  createWrapper,
} from '@lab2view/vue-email-editor'

// Create a text node
const text = createText('<p>Hello world</p>', {
  'font-size': '16px',
  color: '#333333',
})

// Create an image
const img = createImage({
  src: 'https://example.com/photo.jpg',
  alt: 'Product photo',
  width: '300px',
})

// Create a button
const btn = createButton('Shop Now', {
  href: 'https://shop.example.com',
  'background-color': '#e11d48',
  color: '#ffffff',
})

Insert via API

ts
const editor = ref()

// Insert a text block into a specific column
editor.value.insertBlock(
  {
    id: 'custom-text',
    label: 'Custom Text',
    category: 'content',
    icon: 'Type',
    factory: () => createText('<p>Inserted programmatically</p>'),
  },
  'column-node-id',
  0, // index
)

Custom Blocks via Plugins

See the Plugins guide for adding your own blocks.

Released under the MIT License.