<template>
<div class="inputs">
<FormulateInput
type="email"
name="email"
label="Email address"
validation="required|email"
data-tooltip="An email like example@example.com"
>
<template #label="{
label,
id,
attributes: { 'data-tooltip': tooltip }
}">
<label :for="id">
{{ label }}
<svg
v-tooltip="tooltip"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
>
<path d="M50,11A39,39,0,1,0,89,50,39.05,39.05,0,0,0,50,11Zm4,55a4,4,0,0,1-8,0V47a4,4,0,0,1,8,0ZM50,38a4,4,0,1,1,4-4A4,4,0,0,1,50,38Z" />
</svg>
</label>
</template>
</FormulateInput>
</div>
</template>
<script>
export default {
data() {
return {
values: {}
};
},
methods: {
login(data) {
/* do something with data:
* { email: 'zzz@zzz.com', password: 'xyz' }
*/
alert("Logged in");
},
beMike () {
this.values = {
...this.values,
...{ email: 'mike@jordan.com'}
}
}
}
};
</script>
<style lang="scss">
.inputs {
background-color: white;
max-width: 20em;
padding: 2em;
margin: 6.5em auto 2em auto;
border-radius: 0.25em;
box-shadow: 0 0 1em rgba(0, 0, 0, 0.25);
}
label {
display: flex;
align-items: center;
font-size: .9em;
margin-bottom: .25em;
svg {
display: inline-block;
width: 1.5em;
fill: #37c392;
vertical-align: middle;
margin-left: .5em
}
}
html {
min-height: 100%;
}
body {
padding: 2em;
background-image: url("https://vueformulate.com/logo.svg"),
linear-gradient(-45deg, #7ccea9, #ffffff);
background-repeat: no-repeat;
background-size: 3em, 100%;
background-position: center 2em, center center;
}
// tooltip styles
.tooltip {
display: block !important;
z-index: 10000;
.tooltip-inner {
background: black;
color: white;
border-radius: 16px;
padding: 5px 10px 4px;
}
.tooltip-arrow {
width: 0;
height: 0;
border-style: solid;
position: absolute;
margin: 5px;
border-color: black;
z-index: 1;
}
&[x-placement^="top"] {
margin-bottom: 5px;
.tooltip-arrow {
border-width: 5px 5px 0 5px;
border-left-color: transparent !important;
border-right-color: transparent !important;
border-bottom-color: transparent !important;
bottom: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
}
&[x-placement^="bottom"] {
margin-top: 5px;
.tooltip-arrow {
border-width: 0 5px 5px 5px;
border-left-color: transparent !important;
border-right-color: transparent !important;
border-top-color: transparent !important;
top: -5px;
left: calc(50% - 5px);
margin-top: 0;
margin-bottom: 0;
}
}
&[x-placement^="right"] {
margin-left: 5px;
.tooltip-arrow {
border-width: 5px 5px 5px 0;
border-left-color: transparent !important;
border-top-color: transparent !important;
border-bottom-color: transparent !important;
left: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}
}
&[x-placement^="left"] {
margin-right: 5px;
.tooltip-arrow {
border-width: 5px 0 5px 5px;
border-top-color: transparent !important;
border-right-color: transparent !important;
border-bottom-color: transparent !important;
right: -5px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
}
}
&.popover {
$color: #f9f9f9;
.popover-inner {
background: $color;
color: black;
padding: 24px;
border-radius: 5px;
box-shadow: 0 5px 30px rgba(black, .1);
}
.popover-arrow {
border-color: $color;
}
}
&[aria-hidden='true'] {
visibility: hidden;
opacity: 0;
transition: opacity .15s, visibility .15s;
}
&[aria-hidden='false'] {
visibility: visible;
opacity: 1;
transition: opacity .15s;
}
}
</style>