tiny-svg
TypeScript icon, indicating that this package has built-in type declarations

4.1.3 • Public • Published

tiny-svg

CI

tiny-svg is a minimal toolbelt for creating clean SVG applications.

Features

  • no wrapping magic, using native DOM elements instead
  • modular, just use what you need
  • 2kB minified + gzipped
  • innerSVG support
  • simplified attribute handling
  • geometry helpers

Checkout provided utilities.

Usage

import {
  appendTo,
  classes,
  create,
  innerSVG
} from 'tiny-svg';

var container = document.createElement('div');
var element = appendTo(create('svg'), container);

var g = appendTo(create('g'), element);

// add classes, SVG style!
classes(g).add('foo');

var text = `
  <g class="foo bar">
    <rect x="0" y="0" width="0" height="0" rx="50" ry="50"/>
  </g>
`;

// set innerSVG
innerSVG(g, text);

Your favourite module bundler should apply tree-shaking to only include the components your application requires. If you're using CommonJS modules give common-shake a try.

Related

  • min-dom - minimal DOM utility toolbelt
  • min-dash - minimal lodash inspired utility toolbelt

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.1.324,462backports
4.1.3885latest

Version History

VersionDownloads (Last 7 Days)Published
3.1.324,462
4.1.3885
3.1.210,627
4.1.2320
4.1.15
3.1.11
3.1.05
4.1.01
4.0.051
3.0.18,992
3.0.01,153
2.2.421,789
2.2.3819
2.2.26,449
2.2.1214
2.2.043
2.1.214
2.1.11
2.1.030
2.0.01
1.1.0206
1.0.20
1.0.10
1.0.00
0.1.3369
0.1.27
0.1.14
0.1.00
0.0.10

Package Sidebar

Install

npm i tiny-svg

Weekly Downloads

76,448

Version

4.1.3

License

MIT

Unpacked Size

110 kB

Total Files

10

Last publish

Collaborators

  • misiekhardcore
  • abdul99ahad
  • jarekdanielak
  • vsgoulart
  • skaiir-camunda
  • bpmn-io-admin
  • nikku
  • barmac
  • philippfromme
  • maxtru