diff --git a/src/Truncate.tsx b/src/Truncate.tsx index a78a2a76bc5..b2986504081 100644 --- a/src/Truncate.tsx +++ b/src/Truncate.tsx @@ -2,6 +2,7 @@ import React from 'react' import styled from 'styled-components' import {maxWidth, MaxWidthProps} from 'styled-system' import sx, {SxProp} from './sx' +import {ForwardRefComponent as PolymorphicForwardRefComponent} from './utils/polymorphic' import {ComponentProps} from './utils/types' type StyledTruncateProps = { @@ -22,9 +23,11 @@ const StyledTruncate = styled.div` ${sx}; ` -export type TruncateProps = ComponentProps -const Truncate = ({expandable = false, inline = false, maxWidth = 125, ...rest}: TruncateProps) => ( - -) +const Truncate = React.forwardRef(({expandable = false, inline = false, maxWidth = 125, ...rest}, ref) => ( + +)) as PolymorphicForwardRefComponent<'div', StyledTruncateProps> +Truncate.displayName = 'Truncate' + +export type TruncateProps = ComponentProps export default Truncate