Custom Components

icon picker
Picture Uploader

Last edited 101 days ago by MyCondy

How to design it in Power Apps

Preview

Screenshot 2024-09-01 at 7.44.41.png
Screenshot 2024-09-01 at 7.44.28.png

What does it consist of?

4x Container
1x AddMedia
3x Image
1x Vertical Gallery
4x Label
1x Button

Procedure

Step 1 - create cover container
Add a new Vertical Container PCF object, call it "uploader" with this "Gap" property:
25
Step 2 - add header content for the main container
Add a new Image object, call it "empty_picture" with this "Image" property:
"data:image/svg+xml;utf8, " &EncodeUrl("<svg width='232' height='123' viewBox='0 0 232 123' fill='none' xmlns='http://www.w3.org/2000/svg'> <path d='M186.5 0H50.5C44.9772 0 40.5 4.47715 40.5 10V112C40.5 117.523 44.9772 122 50.5 122H186.5C192.023 122 196.5 117.523 196.5 112V10C196.5 4.47715 192.023 0 186.5 0Z' fill='#F0F4FF'/> <path d='M144.5 24H16.5C10.9772 24 6.5 28.4772 6.5 34V51C6.5 56.5228 10.9772 61 16.5 61H144.5C150.023 61 154.5 56.5228 154.5 51V34C154.5 28.4772 150.023 24 144.5 24Z' fill='white'/> <path d='M209.5 72H81.5C75.9772 72 71.5 76.4772 71.5 82V99C71.5 104.523 75.9772 109 81.5 109H209.5C215.023 109 219.5 104.523 219.5 99V82C219.5 76.4772 215.023 72 209.5 72Z' fill='white'/> <path d='M104 32H59C55.9624 32 53.5 34.4624 53.5 37.5C53.5 40.5376 55.9624 43 59 43H104C107.038 43 109.5 40.5376 109.5 37.5C109.5 34.4624 107.038 32 104 32Z' fill='#AFCBFF'/> <path d='M140 46H79C75.9624 46 73.5 48.4624 73.5 51.5C73.5 54.5376 75.9624 57 79 57H140C143.038 57 145.5 54.5376 145.5 51.5C145.5 48.4624 143.038 46 140 46Z' fill='#AFCBFF'/> <path d='M170 80H125C121.962 80 119.5 82.4624 119.5 85.5C119.5 88.5376 121.962 91 125 91H170C173.038 91 175.5 88.5376 175.5 85.5C175.5 82.4624 173.038 80 170 80Z' fill='#AFCBFF'/> <path d='M200 94H138C134.962 94 132.5 96.4624 132.5 99.5C132.5 102.538 134.962 105 138 105H200C203.038 105 205.5 102.538 205.5 99.5C205.5 96.4624 203.038 94 200 94Z' fill='#AFCBFF'/> <path d='M35.5 29H16.5C13.7386 29 11.5 31.2386 11.5 34V52C11.5 54.7614 13.7386 57 16.5 57H35.5C38.2614 57 40.5 54.7614 40.5 52V34C40.5 31.2386 38.2614 29 35.5 29Z' fill='#1059EE'/> <path d='M104.5 77H85.5C82.7386 77 80.5 79.2386 80.5 82V100C80.5 102.761 82.7386 105 85.5 105H104.5C107.261 105 109.5 102.761 109.5 100V82C109.5 79.2386 107.261 77 104.5 77Z' fill='#1059EE'/> </svg>")

Add a new Label object, call it "picture_title" with this "text" property:
"Add a new picture file to upload"

Add a new Label object, call it "picture_dscr" with this "text" property:
"Your picture(s) will be private until publish them"
Step 3 - add media component under sub-container
Add a new Vertical Container PCF object, call it "media_frame" with this "Gap" property:
10

Add a new AddMedia object, call it "add_item" with this "OnChange" property:
ClearCollect(newRecord,{Title:First(Split(add_item.FileName,".")).Value,Suffix:Last(Split(add_item.FileName,".")).Value});
Patch(<Table>,Defaults(<Table>),{Title:First(newRecord).Title,<Table Column>:First(newRecord).Suffix,<Table Image Column>:savedImage.Image});
and "ChangePictureText" property:
"Add file item"
Replace <> by your real table with columns. AddMedia component will get if you put "Add Picture" and take only a button from created group in Power Apps. See example below:
Screenshot 2024-09-01 at 11.36.19.png
Step 4 - add Gallery with data
Add a new Vertical Gallery object, call it "picture_gallery" with this "Data source" property:
<Table>
Replace <Table> by your SharePoint or Dataverse table.
Step 5 - add content for a gallery
Add a new Horizontal Container PCF object, call it "ïtem_frame" with this "DropShadow" property:
DropShadow.Semilight

Add a new Image object under item_frame, call it "picture_image" with this "Image" property:
First(ThisItem.Attachments).Value
Add a new Vertical Container PCF object under item_frame, call it "content_item" with this "Gap" property:
10
Add a new Label object under content_item, call it "picture_name" with this "text" property:
ThisItem.Title
Add a new Label object under content_item, call it "picture_type" with this "text" property:
ThisItem.<Table Column>
Replace <Table Column> by your real table column for image type.

Add a new Button object under item_frame, call it "remove_button" with this "Text" property:
"REMOVE"
and OnSelect property:
Remove(<Table>,ThisItem)
Replace <Table> by your SharePoint or Dataverse table.
Step 6 - add hidden image for uploaded picture (optional)
If you have some issue with PATCH function, that save a BLANK row in your table, you can use this step.
Add a new Image object, call it "savedImage" with this "Image" property:
add_item.Media
and Visible property:
false
This is an output:
Screenshot 2024-09-01 at 7.44.59.png

How to design it in Figma

Preview

Screenshot 2024-09-01 at 7.45.16.png

What does it consist of?

8x Frame
10x Vector
6x Text

Procedure

Step 1 - create parent frame
Add a new Frame (F command) with vertical auto layout (SHIFT + A command) object, call it "vercont_uploader" with these properties:
Screenshot 2024-09-01 at 12.16.52.png
Step 2- create content for a parent frame
Import a new SVG file under a "vercont_uploader" frame, call it "svg_empty_picture" with this XML code:
<svg width="232" height="123" viewBox="0 0 232 123" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M186.5 0H50.5C44.9772 0 40.5 4.47715 40.5 10V112C40.5 117.523 44.9772 122 50.5 122H186.5C192.023 122 196.5 117.523 196.5 112V10C196.5 4.47715 192.023 0 186.5 0Z" fill="#F0F4FF"/>
<path d="M144.5 24H16.5C10.9772 24 6.5 28.4772 6.5 34V51C6.5 56.5228 10.9772 61 16.5 61H144.5C150.023 61 154.5 56.5228 154.5 51V34C154.5 28.4772 150.023 24 144.5 24Z" fill="white"/>
<path d="M209.5 72H81.5C75.9772 72 71.5 76.4772 71.5 82V99C71.5 104.523 75.9772 109 81.5 109H209.5C215.023 109 219.5 104.523 219.5 99V82C219.5 76.4772 215.023 72 209.5 72Z" fill="white"/>
<path d="M104 32H59C55.9624 32 53.5 34.4624 53.5 37.5C53.5 40.5376 55.9624 43 59 43H104C107.038 43 109.5 40.5376 109.5 37.5C109.5 34.4624 107.038 32 104 32Z" fill="#AFCBFF"/>
<path d="M140 46H79C75.9624 46 73.5 48.4624 73.5 51.5C73.5 54.5376 75.9624 57 79 57H140C143.038 57 145.5 54.5376 145.5 51.5C145.5 48.4624 143.038 46 140 46Z" fill="#AFCBFF"/>
<path d="M170 80H125C121.962 80 119.5 82.4624 119.5 85.5C119.5 88.5376 121.962 91 125 91H170C173.038 91 175.5 88.5376 175.5 85.5C175.5 82.4624 173.038 80 170 80Z" fill="#AFCBFF"/>
<path d="M200 94H138C134.962 94 132.5 96.4624 132.5 99.5C132.5 102.538 134.962 105 138 105H200C203.038 105 205.5 102.538 205.5 99.5C205.5 96.4624 203.038 94 200 94Z" fill="#AFCBFF"/>
<path d="M35.5 29H16.5C13.7386 29 11.5 31.2386 11.5 34V52C11.5 54.7614 13.7386 57 16.5 57H35.5C38.2614 57 40.5 54.7614 40.5 52V34C40.5 31.2386 38.2614 29 35.5 29Z" fill="#1059EE"/>
<path d="M104.5 77H85.5C82.7386 77 80.5 79.2386 80.5 82V100C80.5 102.761 82.7386 105 85.5 105H104.5C107.261 105 109.5 102.761 109.5 100V82C109.5 79.2386 107.261 77 104.5 77Z" fill="#1059EE"/>
</svg>
Add a new Text (T command) object under a "vercont_uploader" frame, call it "lbl_picture_title" with these properties:
Screenshot 2024-09-01 at 12.20.45.png
Add a new Text (T command) object under a "vercont_uploader" frame, call it "lbl_picture_dscr" with these properties:
Screenshot 2024-09-01 at 12.21.21.png
Step 3 - add frame for media button
Add a new Frame (F command) with vertical auto layout (SHIFT + A command) object, call it "vercont_media_frame" with these properties:
Screenshot 2024-09-01 at 12.22.36.png
Add a new Frame (F command) with horizontal auto layout (SHIFT + A command) object, call it "addmedia_add_item" with these properties:
Screenshot 2024-09-01 at 12.24.05.png
Add a new Text (T command) object under a "addmedia_add_item" frame, call it "Add File Item" with these properties:
Screenshot 2024-09-01 at 12.25.17.png
Step 4 - add gallery frame
Add a new Frame (F command) with vertical auto layout (SHIFT + A command) object , call it "gall_pictures_gallery" with these properties:
Screenshot 2024-09-01 at 12.26.53.png
Step 5 - add item under gallery frame
Add a new Frame (F command) with horizontal auto layout (SHIFT + A command) object under a "gall_pictures_gallery" frame, call it "horcont_item_frame" with these properties:
Screenshot 2024-09-01 at 12.34.50.png
Screenshot 2024-09-01 at 12.35.08.png
Import a new SVG file under a "horcont_item_frame" frame, call it "img_picture_image" with this XML code:
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" rx="10" fill="#1059EE"/>
<path d="M37 45C38.9778 45 40.9112 44.4135 42.5557 43.3147C44.2002 42.2159 45.4819 40.6541 46.2388 38.8268C46.9957 36.9996 47.1937 34.9889 46.8079 33.0491C46.422 31.1093 45.4696 29.3275 44.0711 27.9289C42.6725 26.5304 40.8907 25.578 38.9509 25.1922C37.0111 24.8063 35.0004 25.0043 33.1732 25.7612C31.3459 26.5181 29.7841 27.7998 28.6853 29.4443C27.5865 31.0888 27 33.0222 27 35C27 37.6522 28.0536 40.1957 29.9289 42.0711C31.8043 43.9464 34.3478 45 37 45ZM37 30C37.9889 30 38.9556 30.2932 39.7779 30.8427C40.6001 31.3921 41.241 32.173 41.6194 33.0866C41.9978 34.0002 42.0969 35.0056 41.9039 35.9755C41.711 36.9454 41.2348 37.8363 40.5355 38.5355C39.8363 39.2348 38.9454 39.711 37.9755 39.9039C37.0055 40.0969 36.0002 39.9978 35.0866 39.6194C34.173 39.241 33.3921 38.6001 32.8427 37.7779C32.2932 36.9556 32 35.9889 32 35C32 33.6739 32.5268 32.4022 33.4645 31.4645C34.4021 30.5268 35.6739 30 37 30ZM24.5 75H74.5C74.8961 75.0001 75.2866 74.9061 75.6393 74.7256C75.9919 74.5452 76.2967 74.2836 76.5284 73.9623C76.7601 73.641 76.9121 73.2692 76.9719 72.8776C77.0318 72.486 76.9977 72.0858 76.8725 71.71L66.8725 41.71C66.7327 41.2902 66.4841 40.915 66.1519 40.6227C65.8197 40.3304 65.4159 40.1316 64.9817 40.0464C64.5475 39.9612 64.0984 39.9928 63.6805 40.138C63.2625 40.2831 62.8905 40.5366 62.6025 40.8725L49.1275 56.595L41 50.5C40.7374 50.303 40.4385 50.1597 40.1205 50.0782C39.8024 49.9967 39.4715 49.9787 39.1464 50.0251C38.8214 50.0716 38.5088 50.1815 38.2263 50.3488C37.9438 50.5161 37.697 50.7374 37.5 51L22.5 71C22.2214 71.3714 22.0518 71.8131 22.0101 72.2755C21.9684 72.7379 22.0563 73.2028 22.2639 73.618C22.4716 74.0333 22.7907 74.3825 23.1857 74.6266C23.5806 74.8707 24.0357 75 24.5 75ZM40 56L48 62C48.5078 62.3808 49.1414 62.5542 49.7723 62.485C50.4033 62.4158 50.9843 62.1093 51.3975 61.6275L63.525 47.48L71.025 70H29.5L40 56Z" fill="white"/>
</svg>
Add a new Frame (F command) with vertical auto layout (SHIFT + A command) object under a "horcont_item_frame" frame, call it "vercont_content_item" with these properties:
Screenshot 2024-09-01 at 12.39.10.png
Add a new Text (T command) object under a "vercont_content_item" frame, call it "lbl_picture_name" with these properties:
Screenshot 2024-09-01 at 12.40.24.png
Add a new Text (T command) object under a "vercont_content_item" frame, call it "lbl_picture_type" with these properties:
Screenshot 2024-09-01 at 12.40.24.png
Add a new Frame (F command) with horizontal auto layout (SHIFT + A command) object under a "horcont_item_frame" frame, call it "btn_remove_button" with these properties:
Screenshot 2024-09-01 at 12.43.17.png
Add a new Text (T command) under a "btn_remove_button" frame, call it "REMOVE" with these properties:
Screenshot 2024-09-01 at 12.43.34.png
This is an output:
Frame 1.png

How to use it via DesignKit

Prerequisites

the designed component according to the instructions from the previous section

Used Prefixes

vercont_uploader, vercont_media_frame, vercont_content_item = Vertical Container
horcont_item_frame = Horizontal Container
gal_picture_gallery = Vertical Gallery
svg_empty_picture, img_picture_image = Image
btn_remove_button = Button
addmedia_add_item = AddMedia
lbl_picture_title, lbl_picture_dscr, lbl_picture_name, lbl_picture_type = Label

YAML Output

Frame 1.png

Used Colours

Container Border Colour - #DFDFE1
Title Font Colour - #000000
Dscr Font Colour - #767980
Button Colour - #FE697F
Picture Item Background - #FFFFFF


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.