Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
react-expand
Advanced tools
Component for controlling expand state of each elements on page.
Somewhere in code
<ExpandController>
<SomeComponent/>
</ExpandController>
Controlling expand state
class SomeComponent extends React.Component {
...
public static readonly contextTypes = ExpandControllerContextTypes;
public readonly context: ExpandContext;
...
public componentDidMount() {
this.context.changeExpandState("custom-expand-string", false, {someData: "data"})();
}
public componentWillUnmount() {
console.log(this.context.getState("custom-expand-string")); // {someData: "data"}
}
public render(): JSX.Element {
return (
<React.Fragment>
// In this case expand state changing on click button
// and click on zone without data attribute "custom-expand-string"
<div
className={this.context.isExpanded("custom-expand-string") ? "visible" : "hidden"}
data-expand="custom-expand-string"
>
<button onClick={this.context.changeExpandState("custom-expand-string")}/>
</div>
// In this case expand state changing only on click button
<div data-expand-keep="more-custom-expand-string">
<button onClick={this.context.changeExpandState("more-custom-expand-string")}/>
</div>
</React.Fragment>
);
}
}
Modal
<Modal defaultOpened closeOnOutside wrapperProps={...HTMLDivElementProps}>
...
<ModalCloseButton {...HTMLButtonElementProps}/>
</Modal>
Collapse
<Collapse
controlElement={({state: boolean, onClick: () => void}) => ...someComponent}
wrapperProps={...HTMLDivElementProps}
defaultOpened
>
...
</Collapse>
Tabs
<TabsController>
<Header tabId="tab_1" {...HTMLDivElementProps} > // Click on header to activate according tab
...
</Header>
<Header tabId="tab_2" {...HTMLDivElementProps} >
...
</Header>
<Tab tabId="tab_1" {...HTMLDivElementProps} >
...
</Tab>
<Tab tabId="tab_2" {...HTMLDivElementProps}>
...
</Tab>
</TabsController>
FAQs
Simple element expand state controlling
The npm package react-expand receives a total of 29 weekly downloads. As such, react-expand popularity was classified as not popular.
We found that react-expand demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.