--- title: Collapse desc: Collapse is used for showing and hiding content. source: https://raw.githubusercontent.com/saadeghi/daisyui/refs/heads/master/packages/daisyui/src/components/collapse.css layout: components classnames: component: - class: collapse desc: Collapse part: - class: collapse-title desc: Title part - class: collapse-content desc: Content part modifier: - class: collapse-arrow desc: Adds arrow icon - class: collapse-plus desc: Adds plus/minus icon - class: collapse-open desc: Force open - class: collapse-close desc: Force close --- > :INFO: > > Also see [accordion](/components/accordion/) examples ### ~Collapse with focus #### This collapse works with focus. When div loses focus, it gets closed
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~Collapse with checkbox #### This collapse works with checkbox instead of focus. It needs to get clicked again to get closed.
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~ Collapse using details and summary tag #### collapse-open and collapse-close doesn't work with this method. You can add/remove open attribute to the details instead
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```
Using <details> tag, we can't have animations because <details> tag doesn't allow CSS transitions.
### ~Without border and background color
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~With arrow icon
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~With arrow plus/minus icon
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~Force open
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
I have collapse-open class
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~Force close
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
I have collapse-open class
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~Custom colors for collapse that works with focus #### Use Tailwind CSS `group` and `group-focus` utilities to apply style when parent div is focused
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
``` ### ~Custom colors for collapse that works with checkbox #### Use Tailwind CSS `peer` and `peer-checked` utilities to apply style when sibling checkbox is checked
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```html
How do I create an account?
Click the "Sign Up" button in the top right corner and follow the registration process.
```