Collapse
Animate presence with slide down transition
Import
Source
Docs
Package
Usage
import { useState } from 'react';import { Button, Collapse } from '@mantine/core';function Demo() {const [opened, setOpen] = useState(false);return (<><Button onClick={() => setOpen((o) => !o)}>Toggle content</Button><Collapse in={opened}>{/* content... */}</Collapse></>);}
Change transition
Set following props to control transition:
transitionDuration
– duration in mstransitionTimingFunction
– timing function (ease, linear, etc.), defaults toease
onTransitionEnd
– called when transition ends (both open and close)
import { useState } from 'react';import { Button, Collapse } from '@mantine/core';function Demo() {const [opened, setOpen] = useState(false);return (<><Button onClick={() => setOpen((o) => !o)}>Toggle with linear transition</Button><Collapse in={opened} transitionDuration={1000} transitionTimingFunction="linear">{/* content... */}</Collapse></>);}
Built by Vitaly Rtishchev and these awesome people