3.1.1 • Published 2 years ago

react-html-writer v3.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

React HTML Writer

Here are some components that will allow you to animate HTML writing on your React application.

Installation

$ npm i react-html-writer

Components

Tag

<Tag></Tag>

As a normal HTML tag, you can nest as much Tag and Text components as you want.

PropertieTypeDescription
nameStringDefine the tagname (div, span, ...)
attrObjectAdd attributes to your tags ( These attributes do not affect child components )
openBooleanOpen de tags when the writing is finished
loopBooleanLoop the animation

Text

<Text />

This component is only used to write strings. The Text component is complitely independent from the Tag component, which means that you can use it by itself to simulate keyboard simple text writing.

PropertieTypeDescription
textStringDefine the string to write
styleObjectStyle the defined text

Styling

You can change the color of each part of your Text and Tags.

<Text /> can be styled via the style property from react.

<Tag></Tag> in the other hand are customizable through the theme prop. You can use those to change colors, sizes, and fonts.

VariableDescription
cursorColorthe cursor color
textColortext color
tagHookColorhooks color, so the greater and minus than ("<", ">")
tagNameColortag names color
attrNameColorthe attributes name color
attrSymbolColorsymbols color, the "=" symbol basically
attrQuoteColorattributes name color
attrValueColorattributes value color
selectColorthe selection color
selectBackgroundColorthe background selection color
fontSizethe font size
fontFamilythe font
tagTabsizetabulation size on indentation

Usage

For a full demo with animtions, try this CodeSandBox or use the Demo page npm run demo.

A simple usage with a simple HelloWorld.

import React from 'react'
import { Tag, Text } from 'react-html-writer'

const HelloWorld = () => (
	<Tag name="h1">
		<Text text="Hello World!" />
	</Tag>
)

export default HelloWorld

The end result will look like this. ( no animation )

<h1>Hello World !</h1>

If you want to import the library via the script tag in your HTML file, you can by using the HTMLWriter global object.

Todolist

  • Create or choose a theme for each component (color, font, size, ...)
  • Add a duration setting
  • Add a timeline
  • Add @types
3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

3 years ago

1.4.8

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.4.7

3 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago