Vuetify RadioGroup full width - vue.js

i have a vuejs app which looks like this
<div id="app">
<v-app>
<v-content>
<v-container fluid>
<v-radio-group v-for="i in list" :key="i">
<v-layout row wrap>
<v-flex md4>
<v-radio label="Test 1" value="a"></v-radio>
</v-flex>
<v-flex md4>
<v-radio label="Test 2" value="b"></v-radio>
</v-flex>
<v-flex md4>
<v-radio label="Test 3" value="c"></v-radio>
</v-flex>
</v-layout>
</v-radio-group>
</v-container>
</v-content>
</v-app>
</div>
(https://codepen.io/anon/pen/NEErNz)
The Problem is that i want to have the radios in full with, but the css class v-input__control which is generated by vuetify blocks this.
Do you have any ideas how i could fix this?
Wrong -> v-input__control -> width: auto
Correct -> v-input__control -> width: 100%

Rithy awnser is almost right but it has 2 problems. The css code affects every control on app (and is not scoped) and v-input__contol class is not accesible by css or your css processor because is scoped inside de control group component. So:
Add a class to your radio group:
<v-radio-group class="radio-group-full-width" v-for="i in list" :key="i">
Then add the css styles (If you use SCSS, if not, see #JakesInTheSoup answer)
<style scoped lang="scss">
.radio-group-full-width {
>>>.v-input__control {
width: 100%
}
}
</style>
The ">>>" is important because it allows the css to access the embeded component scope

#Nacho Moco's answer worked for me with a slight modification to the braces:
<style scoped>
.radio-group-full-width >>>.v-input__control {
width: 100%
}
</style>

just apply style to overwrite existing class
<style scoped>
.v-input__control {
width: 100% !important
}
.v-label {
width: 100% !important
}
</style>

#Nacho Moco's answer worked for me with a slight modification:
<style scoped>
.radio-group-full-width >>> .v-input--radio-group__input {
justify-content: space-between;
}
</style>
Vue 3 gives an error for >>> and the suggested revision is in https://vuejs.org/api/sfc-css-features.html#scoped-css. Expected code is in the form :
<style scoped>
.a :deep(.b) {
/* ... */
}
</style>
The revised code is :
<style scoped>
.radio-group-full-width :deep(.v-input--radio-group__input) {
justify-content: space-between;
}
</style>

I achieved this with Traxo's comment. Here was my layout using Vuetify v1.5.11:
<v-radio-group v-model="selectedDate" class="radio-container d-flex">
<v-radio
class="radio-item"
color="primary"
v-for="item of items"
:key="item.id"
:value="item"
:label="'This is an individual item!'"
></v-radio>
</v-radio-group>
And my CSS:
.radio-container {
max-height: 60vh;
overflow-y: scroll;
.radio-item {
border-bottom: 0.1rem #E5E5E5 solid;
padding: 25px;
}
}

Related

How to blur the background while showing vuetify progress loader

I want to blur the whole background except the progress bar in vuetify I searched a lot for the solution but did not find any of it.
Question: make the whole background dull except for the progress bar
here is how my html layout is
<div class="resume-wrapper">
<v-container fluid>
...
</v-container>
<div class="prg-wrapper">
<span style="display: inline-block; margin-bottom: 17px;">Downloading...</span>
<v-progress-linear
color="deep-purple accent-4"
indeterminate
rounded
height="6"
></v-progress-linear>
</div>
</div>
My css is something like this
.prg-wrapper{
position: fixed;
left: 50%;
top: 29%;
transform: translate(-50%, -50%);
}
I'm using vuetify-2.6.x here is documentation for progress-bar https://vuetifyjs.com/en/components/progress-linear/#file-loader
Please help me thanks in advance!!
You should probably use something like this
<v-overlay :value="spinnerVisible" z-index="998">
<v-progress-circular indeterminate size="64" />
</v-overlay>
Otherwise, you can blur the background with a backdrop filter:
<div class="overlay">
<v-progress-linear
color="deep-purple accent-4"
indeterminate
rounded
height="6"
/>
</div>
<style>
.overlay
{
background-color: rgba(145, 150, 158, 0.6);
backdrop-filter: blur(2px);
}
</style>

how to change the font size of label in <v-checkbox> Vuetify?

I want to change the font size of "attendance",which is the content of label.
<v-checkbox
v-model="course.evaluation"
label="attendance"
></v-checkbox>
Here is what I've tried. Inside the same vue file, I added
<style>
.v-checkbox.v-label {
font-size: 10px;
}
</style>
But it didn't work. Anyone can help?
Try increasing priority by adding chaining selectors
Add a class to the checkbox
<v-checkbox
class="my-checkbox"
v-model="course.evaluation"
label="attendance"
></v-checkbox>
Then
<style>
.my-checkbox .v-label {
font-size: 10px;
}
or In case it still doesn't reflect the override then use deep selector
::v-deep .my-checkbox .v-label {
font-size: 10px;
}
You are using wrong css selectors. You may solve your problem this way:
<style>
.v-input--checkbox .v-label {
font-size: 10px;
}
</style>
But keep in mind that if your component contain more than one v-checkboxes, all of them will have their font changed.
Another solution is to override label slot this way:
<v-checkbox
v-model="course.evaluation">
<template v-slot:label>
<span style="font-size: 10px">attendance</span>
</template>
</v-checkbox>

Navbar transparent in buefy

I am creating a landpaging and I am facing some style difficulties due to lack of practice.
I want to modify the backgroud of the navbar, so I wanted to make the background transparent so that the bottom of the page appears. How can I do this?
enter image description here
<template>
<div class="Shellhub-LP-1280">
<div class="textura Nuvem">
<b-navbar>
<template slot="brand">
<b-navbar-item tag="router-link" :to="{ path: '/' }" transparent="true">
<img
src="https://raw.githubusercontent.com/buefy/buefy/dev/static/img/buefy-logo.png"
alt="Lightweight UI components for Vue.js based on Bulma"
>
<!-- <img src="#/static/logo-inverted.png"> -->
</b-navbar-item>
</template>
...
</b-navbar>
</div>
</div>
</template>
<style>
.Shellhub-LP-1280 {
/* width: 100%; */
height: 2283px;
background-color: #333640;
}
.textura {
/* width: 100%; */
height: 771px;
}
.Nuvem {
width: 100%;
height: 755px;
object-fit: contain;
opacity: 0.9;
float: right;
background: url('../static/nuvem.png');
background-repeat: no-repeat;
background-position: right;
}
Thanks
buefy navbar API:
https://buefy.org/documentation/navbar/#api-view
Passing this props:
<b-navbar :fixed-top="true" :transparent="true" >
Vue docs - components props (recommend to read):
https://v2.vuejs.org/v2/guide/components-props.html
transparent "bug":
Open github issue:
BUG: navbar is-transparent not working .
IMPORTANT: transparent affect navbar items (Not the navbar wrapper himself).
Remove any hover or active background from the navbar items
So add simple CSS styling:
nav.navbar.is-fixed-top {
background: transparent;
}
body top padding issue
I won't find a way to remove body top padding. I added this style:
body{
padding-top: 0px!important;
}
Basic example:
const app = new Vue()
app.$mount('#app')
img.responsive_img{
width: 100%;
height: auto;
}
body{
padding-top: 0px!important;
}
/* change navbar background color */
nav.navbar.is-fixed-top {
background: transparent;
}
<link href="https://unpkg.com/buefy/dist/buefy.min.css" rel="stylesheet"/>
<div id="app">
<b-navbar class="is-link" :fixed-top="true" :transparent="true">
<template slot="brand">
<b-navbar-item tag="router-link" :to="{ path: '/' }">
<img
src="https://raw.githubusercontent.com/buefy/buefy/dev/static/img/buefy-logo.png"
alt="Lightweight UI components for Vue.js based on Bulma"
>
</b-navbar-item>
</template>
<template slot="start">
<b-navbar-item href="#">
Home
</b-navbar-item>
<b-navbar-item href="#">
Documentation
</b-navbar-item>
<b-navbar-dropdown label="Info">
<b-navbar-item href="#">
About
</b-navbar-item>
<b-navbar-item href="#">
Contact
</b-navbar-item>
</b-navbar-dropdown>
</template>
<template slot="end">
<b-navbar-item tag="div">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</b-navbar-item>
</template>
</b-navbar>
<header style="min-height: 200vh;">
<img class="responsive_img" src="https://picsum.photos/2000/600"/>
</header>
</div>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<script src="https://unpkg.com/buefy/dist/buefy.min.js"></script>
Change navbar background color on scroll
only by custom code
See this codepen (I added a class on scroll):
https://codepen.io/ezra_siton/pen/jOPZgmR
Change the background color on scroll her:
nav.navbar.is-fixed-top.isActive{
transition: background-color 0.5s ease;
background: red; /* change color on scroll */
}
Change navbar links color to white (For dark hero) - add "is-link" modifier:
https://bulma.io/documentation/components/navbar/#colors
<b-navbar class="is-link" :fixed-top="true" :transparent="true" >
Remove hover/active
:transparent="true"
Remove any hover or active background from the navbar items.

Is it possible to resize vuetify components?

I recently use Vuetify to implement some UI designs. However, I found the default input component (such as v-text-field, v-select) are too large. I found that I can adjust the width of them, but for the height and font size, how can I change them?
I have had some success using CSS transform to shrink everything:
.compact-form {
transform: scale(0.875);
transform-origin: left;
}
Just add that to your form. Its takes the font-size down to 14px (instead of 16) and shrinks the checkboxes and so on as well.
Although you can use :style bindings, to get what you want you'll have to resort to CSS.
You can use !important to "force in" your styles, but there are alternatives that can make it work without it. See demo below.
new Vue({
el: '#app'
});
#styled-input {
height: 40px;
font-size: 20pt;
}
.styled-input label[for] {
height: 40px;
font-size: 20pt;
}
<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons'>
<link rel='stylesheet prefetch' href='https://unpkg.com/vuetify#1.0.13/dist/vuetify.min.css'>
<script src='https://unpkg.com/babel-polyfill/dist/polyfill.min.js'></script>
<script src='https://unpkg.com/vue/dist/vue.js'></script>
<script src='https://unpkg.com/vuetify#1.0.13/dist/vuetify.min.js'></script>
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-layout row>
<v-flex>
<v-text-field name="input-1" label="Regular Input"></v-text-field>
<v-text-field name="input-1" label="Styled Input" id="styled-input" class="styled-input"></v-text-field>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
I believe that one should always use native vuetify way instead of just using same or stronger CSS selectors or even make some CSS transformations to change size of the whole element...
You can look up all variables in Vuetify docs (more can be found for every component):
https://vuetifyjs.com/en/api/vuetify/#sass-variables
Make sure to check how to enable possibilty to override the variables:
https://vuetifyjs.com/en/features/sass-variables/
For example you can change font-size of text field by overriding $input-font-size: 18px; variable
https://vuetifyjs.com/en/api/v-text-field/#props
add dense
<v-text-field dense></v-text-field>
You can just reference by name as follows.
In your template code:
<v-text-field
class = "inputField input-name p-3 styled-input"
label="username"
name="username"
type="text"
:state="nameState"
v-model="credentials.username"
:rules="rules.username"
color="#01579B"
box
required
/>
In your style code:
.input-name {
background-color: #ffffff;
margin-top: 10px;
}

Change font-size of <v-radio> vuetify

I am newly using vuetify. I want to change font-size of <v-radio> button and its label. Directly applying css not working. So i searched for some answer, but those answer are very short. Which i'm unable to apply them. Can anyone help me to explain how do i change font-size in vuetify? TIA
Updated:
<template>
<v-flex xs6>
<p class="title-input">Jenis Kelamin</p>
<v-radio-group id="id-gender" class="no-space" v-model="genderSelect" :mandatory="false" row #change="genderAction">
<v-radio class="gender" label="Pria" value="Pria"></v-radio>
<v-radio class="gender" label="Wanita" value="Wanita"></v-radio>
</v-radio-group>
<span class="text-error" v-show="genderError">Mohon diisi</span>
</v-flex>
</template>
<style scoped src="../style/Shortform.css">
</style>
Got the answer. In my css file all i have to do is
.customClass >>> label
adding those >>> icon solved the problem.
If you want to use a style tag in the .vue file you have the option to remove scoped from the style tag and target the label directly.
<style>
.v-label {
font-size: desired size
}
</style>
If it happens that you have a separate .css file you can still use this method and ignore the <style> tag
.v-label {
font-size: desired size
}
This worked for me:
.small-radio i {
font-size: 19px;
}
.small-radio label {
font-size: 14px;
padding-left: 0px;
margin-left: -4px;
}
.small-radio .v-radio {
padding: 0px;
}
.small-radio [class*="__ripple"] {
left: 0;
}
Add v-deep:: infront if requred.
Add the style to v-radio-group:
<v-radio-group class="small-radio" v-model="radioGroup">
<v-radio
...
></v-radio>
</v-radio-group>