react-bootstrap#Accordion TypeScript Examples
The following examples show how to use
react-bootstrap#Accordion.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CollapsibleContent.tsx From apps with MIT License | 6 votes |
CollapsibleLight = ({
title,
content,
eventKey,
defaultActiveKey,
}: {
title: Renderable;
content: Renderable;
eventKey: string;
defaultActiveKey: string;
}) => {
return (
<Accordion defaultActiveKey={defaultActiveKey}>
<Card className="collapsible-card">
<Accordion.Toggle as="div" className="collapsible-header-tight" eventKey={eventKey}>
<span className="collapsible-header-title">{title}</span>
<span className="collapsible-header-arrow">
<ArrowToggle eventKey={eventKey} />
</span>
</Accordion.Toggle>
<Accordion.Collapse eventKey={eventKey}>
<>{content}</>
</Accordion.Collapse>
</Card>
</Accordion>
);
}
Example #2
Source File: form-group.component.tsx From cwa-quick-test-frontend with Apache License 2.0 | 6 votes |
FormGroupConsentCkb = (props: any) => {
const accordionRef = React.useRef(null);
const [collapsed, setCollapsed] = React.useState(false);
return (!props ? <></> :
<Form.Group as={Row} controlId='props.controlId'>
<Col sm='10'>
<Accordion ref={accordionRef} onSelect={(evt) => setCollapsed(evt !== null)}>
<Accordion.Toggle as={Form.Label} className='input-label' eventKey='0' >
<strong>{props.title}{(props.required ? '*' : '')}</strong>{!collapsed && props.accordion ? ' (...)' : ''}
</Accordion.Toggle>
<Accordion.Collapse className='px-3' eventKey='0' >
<span className='d-flex input-label text-justify'>{props.accordion}</span>
</Accordion.Collapse>
</Accordion>
</Col>
<Col sm='2' className='jcc-xs-jcfs-md'>
<Form.Check>
<Form.Check.Input
className={props.type === 'radio' ? 'rdb-input' : 'ckb-input'}
onClick={props.onClick}
onChange={props.onChange}
type={props.type}
name={props.name}
disabled={props.readOnly}
checked={props.checked}
required={props.required}
id={props.controlId}
/>
</Form.Check>
</Col>
</Form.Group>
)
}
Example #3
Source File: UploadProgress.tsx From bada-frame with GNU General Public License v3.0 | 6 votes |
ResultSection = (props: ResultSectionProps) => {
const [listView, setListView] = useState(false);
const fileList = props.fileUploadResultMap?.get(props.fileUploadResult);
if (!fileList?.length) {
return <></>;
}
return (
<Accordion defaultActiveKey="1">
<Section>
<Accordion.Toggle eventKey="0" as="div">
<SectionTitle onClick={() => setListView(!listView)}>
{props.sectionTitle}
{listView ? <ExpandLess /> : <ExpandMore />}
</SectionTitle>
</Accordion.Toggle>
<Accordion.Collapse eventKey="0">
<SectionContent>
{props.sectionInfo && (
<SectionInfo>{props.sectionInfo}</SectionInfo>
)}
<FileList
fileList={fileList.map((fileID) => (
<ResultItemContainer key={fileID}>
{props.filenames.get(fileID)}
</ResultItemContainer>
))}
/>
</SectionContent>
</Accordion.Collapse>
</Section>
</Accordion>
);
}
Example #4
Source File: UploadProgress.tsx From bada-frame with GNU General Public License v3.0 | 6 votes |
InProgressSection = (props: InProgressProps) => {
const [listView, setListView] = useState(true);
const fileList = props.fileProgressStatuses ?? [];
return (
<Accordion defaultActiveKey="0">
<Section>
<Accordion.Toggle eventKey="0" as="div">
<SectionTitle onClick={() => setListView(!listView)}>
{props.sectionTitle}
{listView ? <ExpandLess /> : <ExpandMore />}
</SectionTitle>
</Accordion.Toggle>
<Accordion.Collapse eventKey="0">
<SectionContent>
{props.sectionInfo && (
<SectionInfo>{props.sectionInfo}</SectionInfo>
)}
<FileList
fileList={fileList.map(({ fileID, progress }) => (
<InProgressItemContainer key={fileID}>
<span>{props.filenames.get(fileID)}</span>
<span className="separator">{`-`}</span>
<span>{`${progress}%`}</span>
</InProgressItemContainer>
))}
/>
</SectionContent>
</Accordion.Collapse>
</Section>
</Accordion>
);
}
Example #5
Source File: CollapsibleContent.tsx From apps with MIT License | 5 votes |
function renderCollapsibleContent(
{
title,
content,
subheader,
separator,
initialOpen,
accordionKey,
}: {
title: Renderable;
content: Renderable;
subheader: boolean;
separator?: boolean;
initialOpen?: boolean;
accordionKey?: string;
},
enableBottomMargin = true
) {
if (initialOpen === undefined) initialOpen = true;
if (separator === undefined) separator = true;
const eventKey = accordionKey ?? `${title}`;
return (
<Accordion defaultActiveKey={initialOpen ? eventKey : ""}>
<Card className="collapsible-card">
{separator && <hr className="collapsible-header-separator" />}
<Accordion.Toggle className="collapsible-header" as="div" eventKey={eventKey}>
{subheader ? (
<h4 className="collapsible-header-title">{title}</h4>
) : (
<h3 className="collapsible-header-title">{title}</h3>
)}
<span className="collapsible-header-arrow">
<ArrowToggle eventKey={eventKey} />
</span>
</Accordion.Toggle>
{/* 2 px to align the hr line with the start of content */}
<Accordion.Collapse eventKey={eventKey}>
<div style={{ marginTop: "2px", marginBottom: enableBottomMargin ? "1em" : "unset" }}>
{content}
</div>
</Accordion.Collapse>
</Card>
</Accordion>
);
}