0.0.12 • Published 5 years ago

react-maths v0.0.12

Weekly downloads
49
License
-
Repository
-
Last release
5 years ago

Setup

npm install --s react-maths
import React from 'react';
import { MathsEnabler, MathsInput, MathsKeypad } from 'react-maths'

function App() {
  return (
    <MathsEnabler>
      <MathsInput />
      <MathsKeypad>
        <MathsKeypad.Row>
          <MathsKeypad.Key latex='7' cmd='7' />
          <MathsKeypad.Key latex='8' cmd='8' />
          <MathsKeypad.Key latex='$+$' cmd='+' />
          <MathsKeypad.Key latex='$\times$' cmd='\times' />
        </MathsKeypad.Row>
      </MathsKeypad>
    </MathsEnabler>
  )
}

Components

MathsEnabler

A <MathsEnabler /> is a top-level component that:

Props

NameTypeDescription
children*nodePrimary content

*Optional

MathsInput

NameTypeDescription
ref*React.MutableRefObjectA React ref
id*string
onBlur*functionCallback function
onClick*functionCallback function
onFocus*functionCallback function
style*ObjectInline style object

*Optional

MathsKeypad

Props

NameTypeDescription
children*nodeMathsKeypad.Rows
inputRef*React.MutableRefObjectThe React ref attached to the MathsInput which the keypad should create input for
style*ObjectInline style object
when*booleanWhether or not the MathsKeypad is showing

*Optional

MathsKeypad.Row

Props

NameTypeDescription
children*nodeMathsKeypad.Keys
style*ObjectInline style object
weight*numberWeight for the MathsKeypad.Row's height

*Optional

MathsKeypad.Key

Props

NameTypeDescription
component*functionComponent to be rendered
html*stringString to use as inner HTML
latex*stringDollar delimited LaTeX code
commands*Object[]KeyCommands to be processed
cmd*stringPassed to MathQuill's cmd method for the current MathsInput
keystroke*stringPassed to MathQuill's keystroke method for the current MathsInput
write*stringPassed to MathQuill's write method for the current MathsInput
style*ObjectInline style object
weight*numberWeight for the MathsKeypad.Key's width

*Optional

KeyCommands

KeyValue TypeDescription
cmd*stringPassed to MathQuill's cmd method for the current MathsInput
keystroke*stringPassed to MathQuill's keystroke method for the current MathsInput
write*stringPassed to MathQuill's write method for the current MathsInput

*Optional

Hooks

useActiveHtmlElementState

useActiveMathField

useMathQuill

useMathQuillMathField

Helpers

isAMathQuillElement

parseWithKatex

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago