diff --git a/src/components/DropZone/DropZone.scss b/src/components/DropZone/DropZone.scss index e7c10107590..d4658b229f1 100755 --- a/src/components/DropZone/DropZone.scss +++ b/src/components/DropZone/DropZone.scss @@ -66,9 +66,12 @@ $dropzone-overlay-background-error: color('red', 'lighter'); .Container { flex: 1; - display: flex; - justify-content: center; - align-items: center; + + &.centerAlignChildren { + display: flex; + justify-content: center; + align-items: center; + } } .Overlay { diff --git a/src/components/DropZone/DropZone.tsx b/src/components/DropZone/DropZone.tsx index 648f1a692e9..9ee0de34824 100755 --- a/src/components/DropZone/DropZone.tsx +++ b/src/components/DropZone/DropZone.tsx @@ -83,6 +83,11 @@ export interface Props { disabled?: boolean; /** The child elements to render in the dropzone. */ children?: string | React.ReactNode; + /** + * Align child elements to the center of the dropzone. + * @default true + */ + centerAlignChildren?: boolean; /** Allows a file to be dropped anywhere on the page */ dropOnPage?: boolean; /** Sets the default file dialog state */ @@ -213,6 +218,7 @@ export class DropZone extends React.Component { active, overlay, allowMultiple, + centerAlignChildren = true, } = this.props; const inputAttributes: object = { @@ -286,6 +292,11 @@ export class DropZone extends React.Component { ) : null; + const containerClassnames = classNames( + styles.Container, + centerAlignChildren && styles.centerAlignChildren, + ); + const dropZoneMarkup = (
{ > {dragOverlay} {dragErrorOverlay} -
{children}
+
{children}