@dhasdk/simple-ui 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -0
- package/index.css +1 -1
- package/lib/ExpandableText.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Tooltip
|
|
|
26
26
|
- [CharacterCounter](#charactercounter)
|
|
27
27
|
- [CheckBox](#checkbox)
|
|
28
28
|
- [DatePicker](#datepicker)
|
|
29
|
+
- [ExpandableText](#expandabletext)
|
|
29
30
|
- [Input](#input)
|
|
30
31
|
- [List](#list)
|
|
31
32
|
- [Modal](#modal)
|
|
@@ -812,6 +813,58 @@ Default Variant
|
|
|
812
813
|
[Top of Page](#table-of-contents)
|
|
813
814
|
|
|
814
815
|
|
|
816
|
+
<!-- E X P A N D A B L E T E X T --------------------------------------------------------- -->
|
|
817
|
+
|
|
818
|
+
## ExpandableText
|
|
819
|
+
|
|
820
|
+
ExpandableText is a component with a div wrapper that takes in a **`children`** string value, and
|
|
821
|
+
displays a default number of characters with a **more** button. When the button is clicked, the
|
|
822
|
+
text is expanded, and an optional **collapse** button is then shown that can collapse the text
|
|
823
|
+
back to its original sizing.
|
|
824
|
+
|
|
825
|
+
Props exist to style the container, the **more** button, the **collapse** button, to set the
|
|
826
|
+
number of characters to display by default, as well as alternate text for each of the two
|
|
827
|
+
buttons.
|
|
828
|
+
|
|
829
|
+
<!-- children,
|
|
830
|
+
initialChars = 40,
|
|
831
|
+
buttonText = "more",
|
|
832
|
+
classNameMoreButton,
|
|
833
|
+
classNameCollapseButton,
|
|
834
|
+
collapseButton = false,
|
|
835
|
+
collapseText = "collapse",
|
|
836
|
+
className, -->
|
|
837
|
+
|
|
838
|
+
### Props
|
|
839
|
+
|
|
840
|
+
| Prop | Type | Optional | Default | Description |
|
|
841
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
842
|
+
| buttonText | string | Yes | **`'more'`** | text label for the 'more' button
|
|
843
|
+
| className | string | Yes | **`''`** | tailwind classes to style the component container with |
|
|
844
|
+
| classNameCollapseButton | string | Yes | **`ml-2 text-blue-600 underline hover:text-blue-800 focus:outline-none`** | tailwind classes to style the collapse button |
|
|
845
|
+
| classNameMoreButton | string | Yes | **`ml-2 text-blue-600 underline hover:text-blue-800 focus:outline-none`** | tailwind classes to style the collapse button |
|
|
846
|
+
| collapseButton | boolean | Yes | **`false`** | to display a collapse button or not |
|
|
847
|
+
| collapseText | string | Yes | **`'collapse'`** | text label for 'collapse' button |
|
|
848
|
+
| initialChars | integer | Yes | 40 | number of characters to display by default |
|
|
849
|
+
|
|
850
|
+
### Example Usage
|
|
851
|
+
|
|
852
|
+
Default Variant
|
|
853
|
+
|
|
854
|
+
```jsx
|
|
855
|
+
<ExpandableText
|
|
856
|
+
collapseButton={true}
|
|
857
|
+
className='mt-4'
|
|
858
|
+
classNameCollapseButton='block mt-2 strong text-red-600'>
|
|
859
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
860
|
+
</ExpandableText>
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
### Dependencies
|
|
865
|
+
|
|
866
|
+
[Top of Page](#table-of-contents)
|
|
867
|
+
|
|
815
868
|
|
|
816
869
|
<!-- I N P U T ------------------------------------------------------------------------------ -->
|
|
817
870
|
|