Socket
Socket
Sign inDemoInstall

styled-email-components

Package Overview
Dependencies
29
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

styled-email-components

💌 styled-components for emails


Version published
Maintainers
1
Weekly downloads
197
decreased by-28.62%

Weekly downloads

Readme

Source

💌 styled-email-components

npm Version Build Status dependencies Status devDependencies Status

Extension of styled-components (v5.x) with essential features for building email components.

Features

Motivation

styled-components is a universal styling solution with great developer experience and low learning curve. Unfortunately, there's no native support for inline styling which is essential for building emails. This module adds all necessary features to build mail-first components.

Installation

yarn:

yarn add styled-email-components

npm:

npm install --save styled-email-components

Getting Started

Check original Getting Started for more examples.

import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import styled from 'styled-email-components';

const Link = styled.a`
  font-family: sans-serif;
  background: blue;
  color: white;
`;

renderToStaticMarkup(<Link href="https://example.com">Hey</Link>),
// 👇 output
// <a href="https://example.com" style="font-family:sans-serif;background-color:blue;color:white;">Hey</a>

API

styled.*

This module sets list of XHTML 1.0 Transitional element aliases instead of the original HTML5 set, which is a widely used doctype in emails.

Outlook-specific VML elements

In addition to XHTML elements, styled.vml.*, styled.wml.* and styled.office.* aliases are available. These are simple proxies and pass tag names as-is with v:, w: and o: prefixes respectively.

Other APIs

Original APIs are mirrored without any modifications from styled-components. Make sure to check server-side rendering guide for rendering the final email.

License

MIT © Sergey Bekrin

FAQs

Last updated on 02 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc