Skip to main content
Yoummday Light Light Dark System

Profile Image

<sl-profile-image> | SlProfileImage
Since 2.0 experimental Not in big bundle

Show an avatar/profile image with the ability to upload and crop a new image.

<sl-profile-image id="demo" image="https://images.unsplash.com/photo-1529778873920-4da4926a72c2?ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=80"></sl-profile-image>
<script type="module">
  const demo = document.getElementById('demo');
  demo.addEventListener('sl-change', (e) => {
    console.log(e.detail.blob)
  })
</script>

Importing

If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

Script Import Bundler React

To import this component from the CDN using a script tag:

<script type="module" src="https://v2-60-0.yoummday-theme.pages.dev/components/profile-image/profile-image.js"></script>

To import this component from the CDN using a JavaScript import:

import 'https://v2-60-0.yoummday-theme.pages.dev/components/profile-image/profile-image.js';

To import this component using a bundler:

import '@yoummday/ymmd-shoelace/dist/components/profile-image/profile-image.js';

To import this component as a React component:

import SlProfileImage from '@yoummday/ymmd-shoelace/dist/react/profile-image';

Properties

Name Description Reflects Type Default
image The profile image string ''
header The header text string 'Crop image'
buttonLabel The confirm button label string 'Save'
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Events

Name React Event Description Event Detail
sl-change onSlChange Emitted when image has changed. CustomEvent

Learn more about events.

Custom Properties

Name Description Default
--size The size of the avatar.

Learn more about customizing CSS custom properties.

Dependencies

This component automatically imports the following dependencies.

  • <sl-avatar>
  • <sl-dialog>
  • <sl-file-upload>
  • <sl-icon>
  • <sl-icon-button>