1.1.8 • Published 2 months ago

@synerise/ds-code-area v1.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

id: code-area

title: CodeArea

CodeArea UI Component

Installation

npm i @synerise/ds-code-area
or
yarn add @synerise/ds-code-area

To have syntax validation you need to follow the integration instructions here: https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md

Usage

import CodeArea from '@synerise/ds-code-area'

type SupportedSyntaxes = 'json' | 'javascript';
const syntaxOptions = [
    {
        language: 'json',
        label: 'JSON'
    },
    {
        language: 'javascript',
        label: 'Javascript'
    }
];

<CodeArea<SupportedSyntaxes>
    syntaxOptions={syntaxOptions}
    onSyntaxChange={ /* current syntax handler */ }
    onChange={ /* current value handler */ }
/>

API

PropertyDescriptionTypeDefault
labellabel above editorReactNode-
fullscreenLabellabel above editor in fullscreen mode (defaults to label prop)ReactNode-
descriptiondescription below editorReactNode-
counterlimit character count{ limit: number; placement?: 'bottom' &#124; 'top'; }-
errorTexterror message to show below editor (also adds "error styles")ReactNode-
syntaxOptionsarray of available syntaxesCodeAreaSyntaxOption[]-
currentSyntaxcurrent syntax of editor valueCodeAreaSyntax-
allowFullscreenrenders fullscreen mode buttonboolean-
readOnlyrenders readOnly modeboolean-
tooltiptooltip text displayed next to labelReactNode-
tooltipPropstooltip properties (see @synerise/ds-tooltip)TooltipExtendedProps & TooltipProps-
stylecustom style added to outermost divCSSProperties-
classNameclass name to add to outermost divstring-
renderFooterContentrenders custom content in footer bar(CodeAreaStateProps) => ReactNode-
renderAdditionalDescriptionrenders custom content above description(CodeAreaStateProps) => ReactNode-
onFullscreenChangetriggered when fullscreen is toggled on/off(isFullscreen: boolean) => void-
onSyntaxChangetriggered when user switches syntax(newSyntax: SyntaxName) => void-
textscustomise displayed textsCodeAreaTexts-
getPopupContainercustomise where fullscreen layer is rendered intogetPopupContainer (@synerise/ds-utils)-

CodeAreaTexts

Customisable user-facing labels

PropertyDescriptionTypeDefault
fullscreenfullscreen button labelReactNode-
closeFullscreenclose fullscreen button labelReactNode-
fullscreenTitleused in fullscreen mode if no label prop providedReactNode-

CodeAreaSyntaxOption

At least one syntax option must be provided.

PropertyDescriptionTypeDefault
languagelanguage of editor valueCodeAreaSyntax-
labeloptional user-friendly display namestring-

CodeAreaSyntax

See list of languages supported by monaco here: https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages.

CodeAreaSyntax = 'json' | 'html' | 'css' | 'typescript' | 'javascript' | string;

CodeAreaStateProps

Props passed to renderAdditionalDescription() and renderFooterContent().

PropertyDescriptionTypeDefault
isFullscreenis fullscreen mode on or offboolean-
countcurrent character countnumber-
isValidis editor value validboolean-
1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.1.8

2 months ago

1.1.7

2 months ago

1.1.6

3 months ago

1.1.5

3 months ago

1.1.4

3 months ago

1.1.3

3 months ago

1.1.2

4 months ago

0.6.3

5 months ago

0.6.2

6 months ago

0.6.1

6 months ago

0.6.0

6 months ago

0.5.8

6 months ago

0.5.9

6 months ago

0.5.6

6 months ago

0.5.5

6 months ago

0.5.7

6 months ago

0.5.4

6 months ago

0.5.3

6 months ago

0.5.0

7 months ago

0.5.2

7 months ago

0.5.1

7 months ago

0.4.4

7 months ago

0.4.3

7 months ago

0.3.0

9 months ago

0.2.0

9 months ago

0.4.1

8 months ago

0.3.2

9 months ago

0.4.0

8 months ago

0.3.1

9 months ago

0.3.4

9 months ago

0.4.2

8 months ago

0.3.3

9 months ago

0.1.31

10 months ago

0.1.32

10 months ago

0.1.30

10 months ago

0.1.29

10 months ago

0.1.27

11 months ago

0.1.28

11 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.20

1 year ago

0.1.21

12 months ago

0.1.22

12 months ago

0.1.23

12 months ago

0.1.24

12 months ago

0.1.25

11 months ago

0.1.26

11 months ago

0.1.16

1 year ago

0.1.8

1 year ago

0.1.17

1 year ago

0.1.7

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago