Tooltip
Basic Usage
Loading...
<CTooltip content="Hello, world"><CButton label="Hover Me" /></CTooltip>
Fold/Expand Code
Positions
Loading...
function Demo() {const positions = ['top-left','top','top-right','right-top','right','right-bottom','bottom-left','bottom','bottom-right','left-top','left','left-bottom',]return (<divstyle={{display: 'grid',gridTemplateColumns: 'repeat(3, 1fr)',gap: '24px',}}>{positions.map(p => (<CTooltipkey={p}position={p}content={`Message from position: ${p}`}><divstyle={{ color: '#fff', backgroundColor: 'var(--casual-primary)', lineHeight: '3em', textAlign: 'center' }}>{p}</div></CTooltip>))}</div>)}
Fold/Expand Code
Trigger Methods
Loading...
function Demo() {const [show, setShow] = useState(false)return (<div className="c-row c-gutter-x-md"><div><CTooltip content="Hello, world"><CButtonflatroundedlabel="Hover (default)"/></CTooltip></div><div><CTooltiptrigger="click"content="Hello, world"><CButtonroundedlabel="Click"/></CTooltip></div><div><CButtonlabel="Manual"onClick={() => setShow(!show)}/><CTooltiptrigger="manual"content="Hello, world"show={show}toggleShow={setShow}>Click left button to show</CTooltip></div></div>)}
Fold/Expand Code
Customize Content
Loading...
<CTooltipcontent={<div>Look! This is some custom content.<CButtonlabel="Even with a button"flatround/></div>}><CButton label="Hover Me" /></CTooltip>
Fold/Expand Code
Props
Name (*for required) | Description | Type | Default Value |
---|
No Data