Skip to content

Show more/less text #115

@jeromecauchon

Description

@jeromecauchon

I found a way to show more text but i cannot figured out how to show less text. Once expanded, the textTruncateChild disappear.

const [expanded, setExpanded] = useState(false);
  return (
      <TextTruncate
          line={expanded ? 2000 : props.lines}
          element="span"
          truncateText="…"
          text={props.text}
          textTruncateChild={<a onClick={() => {setExpanded(!expanded)}}>{expanded?'less': 'more'}</a>}
      />
  );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions