You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/components/TextRenderer/TextRenderer.mdx
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,26 @@ The text representation can be customized using the appropriates tag attributes
20
20
21
21
Notes:
22
22
23
-
- This component is rendering text transformed by predefined, standard functions like "lowercase", "uppercase", "camelcase", "kebabcase" etc.
23
+
- This component is rendering text transformed by predefined, standard `transform` functions:
24
+
-**no-op**: the text is rendered as-is (_no operation_)
25
+
-**lower-case**: use the standard `toLowerCase()` string transformation for rendition.
26
+
-**upper-case**: use the standard `toUpperCase()` string transformation for rendition.
27
+
-**camel-case**: starts by making the first word lowercase. Then, it capitalizes the first letter of each word that follows. Then It removes the non-letter chars from the text.
28
+
`My name is Nobody`→`myNameIsNobody`.
29
+
-**pascal-case**: capitalizes the first letter of each word. Then It removes the non-letter chars from the text.
30
+
`My name is Nobody`→`MyNameIsNobody`.
31
+
-**snake-case**: separates each word with an underscore character (`_`). The rendered result is lowercased.
32
+
`My name is Nobody`→`my_name_is_nobody`.
33
+
-**kebab-case**: separates each word with a dash character (`-`). The rendered result is lowercased.
34
+
`My name is Nobody`→`my-name-is-nobody`.
35
+
-**to-base64**: renders a valid UTF-16 string to it's Base64 encoded representation.
⚠ this may throw an Error if the input value is not a valid Base64 string. ⚠
41
+
-**camel-to-kebab**: renders a camel-cased string into it's kebab-case representation.
42
+
-**pascal-to-kebab**: renders a pascal-cased string into it's kebab-case representation.
24
43
- The values and options used/available within the "Control" column are for demonstration purpose only.
25
44
- Use the "Reset controls" button on the top right side of the table in order to restore the initial demo values and options. Alternatively, you could reload the page.
26
45
@@ -30,7 +49,7 @@ Notes:
30
49
import { TextRenderer } from 'react-text-renderer-components';
description: "The text **value** (string) which should be transformed and rendered.",
13
+
title: 'Components/TextRenderer',
14
+
component: TextRenderer,
15
+
argTypes: {
16
+
value: {
17
+
control: "text",
18
+
description: "The text **value** (string) which should be transformed and rendered.",
19
+
},
20
+
pure: {
21
+
control: "boolean",
22
+
description: "If **pure** is set/defined, then the component will render nothing but the 'pure' text representation of the value. Otherwise, the text representation is embeded within a *<span></span>* tag.",
23
+
},
24
+
transform: {
25
+
control: "select",
26
+
description: "The type of transformation to be applied to the input values.",
27
+
options: TextTransformations,
28
+
}
17
29
},
18
-
pure: {
19
-
control: "boolean",
20
-
description: "If **pure** is set/defined, then the component will render nothing but the 'pure' text representation of the value. Otherwise, the text representation is embeded within a *<span></span>* tag.",
description: {component: "The **TextRenderer** component renders an input *value* of type `string` to a pure/spanned representation showing the transformed text as defined by the `transform` attribute of the component."},
35
+
},
36
+
layout: 'centered'
21
37
},
22
-
transform: {
23
-
control: "select",
24
-
description: "The type of transformation to be applied to the input values.",
description: {component: "The **TextRenderer** component renders an input *value* of type `string` to a pure/spanned representation showing the transformed text as defined by the `transform` attribute of the component."},
0 commit comments