Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@myuw-web-components/myuw-profile

Package Overview
Dependencies
Maintainers
6
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@myuw-web-components/myuw-profile

Web component that provides an avatar button and profile menu

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
406
decreased by-1.69%
Maintainers
6
Weekly downloads
 
Created
Source

myuw-profile

Getting Started

Add the following import to your page's <head>:

<script type="module" src="https://unpkg.com/@myuw-web-components/myuw-profile@^1?module"></script>
<script nomodule src="https://unpkg.com/@myuw-web-components/myuw-profile@^1"></script>

Use the component's HTML tag wherever you want:

<myuw-profile
    login-url=""
    logout-url=""
    background-color=""
>
</myuw-profile>

Login event

To tell the component that there is an active session, dispatch a CustomEvent called "myuw-login":

var customEvent = new CustomEvent('myuw-login', {
  bubbles: true, // optional
  detail: { // required object "detail"
    person: { // required object "person"
      "firstName": "User" // optional property "firstName"
    }
  }
});
// Dispatch the event
document.getElementsByTagName('myuw-profile')[0].dispatchEvent(customEvent);       

Notes:

  • The "bubbles" property is required if you dispatch the event from an element/scope other than document
  • The "detail" object is required by the CustomEvent spec
  • The "person" object is required by the myuw-profile component
  • The "firstName" attribute determines the letter displayed in the profile menu button and the name displayed within the menu. If no first name is provided, the button will show a generic "person" icon
Configurable properties
  • Login URL (login-url): The URL to redirect users to on login
  • Logout URL (logout-url): The Logout URL to redirect users to on logout
  • Background color (background-color): Use this to dynamically set the background color of the profile menu button
Slots
  • Profile Navigation Item (nav-item): Add a custom item to the profile button's navigation menu, this slot expects an <a> tag
CSS Variables
  • --myuw-profile-font: Set the font stack for this component
  • --myuw-profile-login-color: Set the font color of the "Login" button
  • --myuw-profile-background-color: Set the background color of the circular menu button
  • --myuw-menu-color: The text color of links/buttons in the profile menu

For more information about CSS variables and how they work with MyUW Web Components, reference the styles component

FAQs

Package last updated on 17 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc