We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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>} /> );
The text was updated successfully, but these errors were encountered:
This is how i make it work.
const [expanded, setExpanded] = useState(false); return ( {expanded ? ( <Typography> {props.text} <a href='#' style={{ color: 'red' }} onClick={() => { setExpanded(!expanded); }}> {props.readLessText} </a> </Typography> ) : ( <TextTruncate line={props.lines} truncateText='…' text={props.text} textTruncateChild={ <a href='#' style={{ color: 'red' }} onClick={() => { setExpanded(!expanded); }}> {props.readMoreText} </a> } /> )});
Sorry, something went wrong.
No branches or pull requests
I found a way to show more text but i cannot figured out how to show less text. Once expanded, the textTruncateChild disappear.
The text was updated successfully, but these errors were encountered: