@startupjs-ui/collapse 0.1.13 → 0.1.16

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
7
+
8
+ **Note:** Version bump only for package @startupjs-ui/collapse
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
7
15
 
8
16
  **Note:** Version bump only for package @startupjs-ui/collapse
package/README.mdx CHANGED
@@ -11,7 +11,7 @@ import Div from '@startupjs-ui/div'
11
11
 
12
12
  Inherits [react-native-collapsible](https://github.com/oblador/react-native-collapsible).
13
13
 
14
- Collapse allows to toggle the visibility of content.
14
+ Collapse lets you toggle the visibility of a content section with a smooth animation.
15
15
 
16
16
  ```jsx
17
17
  import { Collapse } from 'startupjs-ui'
@@ -19,6 +19,8 @@ import { Collapse } from 'startupjs-ui'
19
19
 
20
20
  ## Simple example
21
21
 
22
+ Use the `open` and `onChange` props to control visibility. Pass a `title` to display a default header.
23
+
22
24
  ```jsx example noscroll
23
25
  const [open, setOpen] = useState(false)
24
26
  return (
@@ -30,7 +32,7 @@ return (
30
32
 
31
33
  ## Pure collapse
32
34
 
33
- Pure collapse does not contain any styles (background, paddings, etc.). It is useful when `Collapse` is used as a children of other components like `Card`. To make it pure, pass the string `pure` to the `variant` property.
35
+ The pure variant strips all default styling (background, paddings, etc.), which is useful when embedding a Collapse inside other components like `Card`. Set `variant='pure'` to enable it.
34
36
 
35
37
  ```jsx example noscroll
36
38
  const [open, setOpen] = useState(false)
@@ -48,7 +50,7 @@ return (
48
50
 
49
51
  ## Advanced usage
50
52
 
51
- Collapse consists of two parts - `Header` and `Content`. These parts can be used to add custom markup, the `Header` is used instead of title and the `Content` is used instad of children. They can be used separately. Each part take value of `variant` prop from parent `Collapse` which can be overridden by passing `variant` to itself.
53
+ Collapse consists of two sub-components: `Collapse.Header` and `Collapse.Content`. Use these instead of the `title` prop and direct children when you need custom markup. Each sub-component inherits the `variant` from the parent Collapse, but you can override it by passing `variant` directly to the sub-component.
52
54
 
53
55
  ```jsx example noscroll
54
56
  const [open, setOpen] = useState(false)
@@ -64,7 +66,7 @@ return (
64
66
 
65
67
  ## Icon configuration
66
68
 
67
- You can provide a custom icon by specifying the `icon` option. It must be an arrow-like icon pointing right.
69
+ You can provide a custom icon by passing it to the `icon` prop. The icon should be an arrow-like icon pointing right, as it rotates 90 degrees when the collapse opens.
68
70
 
69
71
  ```jsx example
70
72
  const [open, setOpen] = useState(false)
@@ -80,13 +82,42 @@ return (
80
82
  )
81
83
  ```
82
84
 
83
- ### No Icon
85
+ ### No icon
86
+
87
+ You can remove the icon entirely by setting `icon={false}`.
88
+
89
+ ## Animation options
90
+
91
+ The collapse animation can be customized through props passed to `Collapse` (or directly to `Collapse.Content`):
92
+
93
+ - **duration** -- animation duration in milliseconds
94
+ - **easing** -- easing function or preset name for the animation curve
95
+ - **collapsedHeight** -- the height of the content area when collapsed (defaults to fully collapsed)
96
+ - **align** -- vertical alignment of the content when partially collapsed (`top`, `center`, or `bottom`)
97
+ - **enablePointerEvents** -- allow pointer events on the content while it is collapsed
98
+ - **renderChildrenCollapsed** -- render children even when the section is collapsed (useful for preserving state)
99
+ - **onAnimationEnd** -- callback fired after the collapse or expand animation finishes
100
+
101
+ ## Custom styles
102
+
103
+ You can customize the appearance using style props:
104
+
105
+ - **style** -- custom styles for the root container
106
+ - **collapsibleContainerStyle** -- custom styles for the collapsible content wrapper
107
+
108
+ When using `Collapse.Header`, additional style props are available:
109
+
110
+ - **style** -- custom styles for the header root
111
+ - **iconStyle** -- custom styles for the header icon
112
+ - **containerStyle** -- custom styles for the header content container
113
+
114
+ ## Two-way binding
84
115
 
85
- You can remove an icon completely by specifying `icon={false}`
116
+ Instead of manually managing the `open` and `onChange` props, you can use the `$open` prop with a scoped model for automatic two-way data binding.
86
117
 
87
118
  ## Accordion
88
119
 
89
- Using the `Collapse` component, you can create behavior like an accordion.
120
+ You can build accordion behavior using multiple Collapse components with shared state.
90
121
 
91
122
  ```jsx example noscroll
92
123
  const [expand, setExpand] = useState()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs-ui/collapse",
3
- "version": "0.1.13",
3
+ "version": "0.1.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,9 +9,9 @@
9
9
  "type": "module",
10
10
  "dependencies": {
11
11
  "@startupjs-ui/core": "^0.1.11",
12
- "@startupjs-ui/div": "^0.1.13",
13
- "@startupjs-ui/icon": "^0.1.13",
14
- "@startupjs-ui/span": "^0.1.13",
12
+ "@startupjs-ui/div": "^0.1.16",
13
+ "@startupjs-ui/icon": "^0.1.16",
14
+ "@startupjs-ui/span": "^0.1.16",
15
15
  "react-native-collapsible": "^1.6.2"
16
16
  },
17
17
  "peerDependencies": {
@@ -19,5 +19,5 @@
19
19
  "react-native": "*",
20
20
  "startupjs": "*"
21
21
  },
22
- "gitHead": "5cfdccf2bdae3873e968289a3e6b938fad02101a"
22
+ "gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
23
23
  }