@sonnetjs/svg
v0.0.13
Published
sonnetjs/svg is a library for creating SVG elements using a simple and declarative API.
Downloads
82
Maintainers
Readme
sonnetjs/svg
sonnetjs/svg is a library for creating SVG elements using a simple and declarative API.
Features
- Create SVG elements using a simple and declarative API.
- Set attributes and properties of SVG elements using chainable methods.
- Add children to SVG elements using children method.
Usage
- Run the following command to create a new SonnetJS project.
npx create-sonnet-app@latest
- Change directory to the newly created project.
cd [my-sonnet-app]
- Install the dependencies
npm i
- Install sonnetjs/svg
npm i @sonnetjs/svg
- Start the development server
npm run dev
Documentation
This is a simple example of how to use sonnetjs/svg to create an SVG element.
import { svg, rect } from '@sonnetjs/svg';
const element = svg()
.width(100)
.height(100)
.children(rect().x(10).y(10).width(80).height(80).fill('red'));
License
sonnetjs/svg is licensed under the MIT license.