1.1.8 • Published 29 days ago

@synerise/ds-code-area v1.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
29 days 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

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.1.1

3 months ago

1.1.0

3 months ago

1.1.8

29 days ago

1.1.7

1 month ago

1.1.6

1 month ago

1.1.5

1 month ago

1.1.4

2 months ago

1.1.3

2 months ago

1.1.2

2 months ago

0.6.3

4 months ago

0.6.2

4 months ago

0.6.1

4 months ago

0.6.0

4 months ago

0.5.8

4 months ago

0.5.9

4 months ago

0.5.6

5 months ago

0.5.5

5 months ago

0.5.7

5 months ago

0.5.4

5 months ago

0.5.3

5 months ago

0.5.0

5 months ago

0.5.2

5 months ago

0.5.1

5 months ago

0.4.4

6 months ago

0.4.3

6 months ago

0.3.0

8 months ago

0.2.0

8 months ago

0.4.1

7 months ago

0.3.2

7 months ago

0.4.0

7 months ago

0.3.1

8 months ago

0.3.4

7 months ago

0.4.2

7 months ago

0.3.3

7 months ago

0.1.31

9 months ago

0.1.32

8 months ago

0.1.30

9 months ago

0.1.29

9 months ago

0.1.27

10 months ago

0.1.28

9 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

11 months ago

0.1.21

11 months ago

0.1.22

10 months ago

0.1.23

10 months ago

0.1.24

10 months ago

0.1.25

10 months ago

0.1.26

10 months ago

0.1.16

12 months ago

0.1.8

1 year ago

0.1.17

12 months ago

0.1.7

1 year ago

0.1.18

11 months ago

0.1.19

11 months 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