🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-collapsible-paragraph

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-collapsible-paragraph

A collapsible paragraph component for reactjs projects

1.0.9
latest
Source
npm
Version published
Weekly downloads
57
46.15%
Maintainers
1
Weekly downloads
 
Created
Source

react-collapsible-paragraph

A Collapsible Paragraph Component for Reactjs

npm NPM npm type definitions

Current works

Customizable expan/collapse handler

Install

yarn add react-collapsible-paragraph
# or
npm install react-collapsible-paragraph

Usage

import React from "react";
import Collapsible from "react-collapsible-paragraph";

function App() {
  return (
    <div style={{ lineHeight: "22px" }}>
      <Collapsible lines={2}>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
        veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
        commodo consequat.
      </Collapsible>
    </div>
  );
}

Essential

  • Collapsible inherits its parentElement's lineHeight which is necessay for the collapse mechanism. Therefore, parent must provide lineHeight property

Props

PropsTypesExpanationDefault
linesnumberIf the content is longer than a certain line number. The content can be collapsed2
locales{expand: string; collapse: string}Locale for expan/collapse handler based on controlled usage{expand: "expand", collapse: "collapse"}

Demo

Keywords

react

FAQs

Package last updated on 27 Mar 2021

Did you know?

Socket

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.

Install

Related posts