lenards/elm-ui-patternfly/4.0.2

PF6.FileUpload

PF6 FileUpload component

Provides a drag-and-drop file upload zone. Actual file reading requires a port in the consumer application. This component handles the visual UI only: the drop zone, drag-over highlighting, selected file display, and clear button.

See: https://www.patternfly.org/components/file-upload

Definition

type FileUpload msg

Opaque FileUpload type

Constructor

Construct an empty FileUpload drop zone

State modifiers

withIsDragOver : Bool -> FileUpload msg -> FileUpload msg

Set drag-over state (highlight drop zone while a file is dragged over it)

withFileName : String -> FileUpload msg -> FileUpload msg

Show the selected file name

withFileSize : String -> FileUpload msg -> FileUpload msg

Show the selected file size (e.g. "2.4 MB")

Disable the file upload zone

Event modifiers

withOnClick : msg -> FileUpload msg -> FileUpload msg

Set the message sent when the drop zone is clicked (open file browser)

withOnClear : msg -> FileUpload msg -> FileUpload msg

Set the message sent when the clear button is clicked

Display modifiers

withAccept : String -> FileUpload msg -> FileUpload msg

Accepted file types hint (e.g. ".jpg, .png, .gif")

withHelperText : String -> FileUpload msg -> FileUpload msg

Helper text displayed below the drop zone

Rendering

toMarkup : Theme -> FileUpload msg -> Element msg

Render the FileUpload as an Element msg