Vue
This packages provides Hellō button components that you can use in a Vue SPA.
Setup
To add Hellō to your Vue application, in your project directory:
Install the package
npm i @hellocoop/vue
Add Hellō stylesheet
To provide the button styling, add the below code to the <head>
section of the index.html
:
<link rel="stylesheet" href="https://cdn.hello.coop/css/hello-btn.css"/>
Components
import { // only import buttons used
ContinueButton,
LoginButton,
UpdateProfileButton
} from '@hellocoop/vue'
Buttons
<ContinueButton/>
- provides [ ō Continue with Hellō ]
<LoginButton/>
- provides [ ō Login with Hellō ]
<UpdateProfileButton/>
- provides [ ō Update Profile with Hellō ]
Optional properties:
scope
- Array of Hellō scope values. Default['openid', 'email', 'name', 'picture']
.targetURI
- defaults toHELLO_DEFAULT_TARGET_ROUTE
or '/'providerHint
- Array of provider hints. Example['github', 'gitlab', 'email--', 'apple--', 'microsoft--']
would always recommend GitHub, GitLab, and Google.loginHint
- A hint for which user account to use. Only email addresses in the form of mailto:name@domain.example are currently supported.promptLogin
- defaults tofalse
. Will require the user to re-authenticate at their login provider.promptConsent
- defaults tofalse
. Will require the user to review, and potentially change, released claims.
Optional button styling properties:
color
- white | blacktheme
- ignore-light | ignore-dark | aware-invert | aware-statichover
- pop | glow | flare | none
Explore styling with the button playground
<HelloProvider/>
By default, clicking the Hellō button would redirect to /api/hellocoop?op=login
endpoint with the optional properties as additional query parameters. To override this behavior, wrap your app with the <HelloProvider/>
component and pass the config
object as a prop to the provider.
<script setup>
import { HelloProvider } from '@hellocoop/vue';
//default
const config = {
login: '/api/hellocoop?op=login'
}
</script>
<template>
<HelloProvider :config="config">
<main>
...
</main>
</HelloProvider>
</template>