1- import React , { useState } from "react" ;
1+ import React , { useState } from "react" ;
22
3- import { Link , Spacing } from "../../index" ;
3+ import { Link , Spacing , InlineText } from "../../index" ;
44
55export interface ContentBlobTogglerProps extends React . HTMLAttributes < HTMLDivElement > {
66 /**
@@ -31,6 +31,10 @@ export interface ContentBlobTogglerProps extends React.HTMLAttributes<HTMLDivEle
3131 Callback if toggler is necessary. Default: true
3232 */
3333 enableToggler ?: boolean ;
34+ /**
35+ * Force always inline rendering.
36+ */
37+ forceInline ?: boolean ;
3438}
3539
3640/** Shows a preview with the option to expand to a full view (and back). */
@@ -42,6 +46,7 @@ export function ContentBlobToggler({
4246 fullviewContent,
4347 startExtended = false ,
4448 enableToggler = true ,
49+ forceInline = false ,
4550 ...otherProps
4651} : ContentBlobTogglerProps ) {
4752 const [ isExtended , setViewState ] = useState ( startExtended ) ;
@@ -51,7 +56,7 @@ export function ContentBlobToggler({
5156 setViewState ( ! isExtended ) ;
5257 } ;
5358
54- return (
59+ const tooglerDisplay = (
5560 < div className = { className } { ...otherProps } >
5661 { ! isExtended ? (
5762 < >
@@ -76,7 +81,7 @@ export function ContentBlobToggler({
7681 { fullviewContent }
7782 { enableToggler && (
7883 < div >
79- < Spacing size = "small" />
84+ { forceInline ? < > { " " } </ > : < Spacing size = "small" /> }
8085 < Link
8186 data-test-id = { "content-blob-toggler-less-link" }
8287 href = "#less"
@@ -92,4 +97,6 @@ export function ContentBlobToggler({
9297 ) }
9398 </ div >
9499 ) ;
100+
101+ return forceInline ? < InlineText > { tooglerDisplay } </ InlineText > : tooglerDisplay ;
95102}
0 commit comments