I know I can use predefined material design (or font awesome etc...) icons in Vuetify like this:
<v-icon>mdi-clock</v-icon>
But is there a way to use v-icon component to display my custom icon defined as svg in my-icon.svg file? This .svg file is located located in my project public/img directory but how can I reference it inside v-icon component?
AFAIK If you want to use as external svg, the answer is unfortunately no.
Anyway, you can import the svg file as a component with vue-svg-loader then use inside v-icon.
import Stack from "#/icons/stack.svg"; // import /src/icons/stack.svg
export default {
components: {
Stack
}
};
Then use it
<v-icon>
<Stack/>
</v-icon>
Another solution How To Add Custom SVG Icon in Vuetify - Vue.
You can achieve the same using CSS.
.v-icon
height 20px
width 20px
&.engine
background-image url(https://www.svgrepo.com/show/9344/train.svg)
background-size contain
background-repeat no-repeat
&::before
visibility hidden
content ""
check out this codepen.
Related
I am working on a website made with Gatsby v. 4. On static pages the template expects a background image that takes up slightly less than half the screen. All background images are loaded via the StaticImage component of Gatsby's 'gatsby-plugin-image' plugin.
Is there a way to get this background image by using the height and width (or other) attributes of Gatsby's StaticImage component?
I am currently achieving this through an external .scss style sheet in this way:
img {
height: calc(50vh);
width: calc(300vh);
}
You have exposed an style or imgStyle props in both: StaticImage as well as GatsbyImage.
style: Inline styles applied to the outer wrapper.
imgStyle: Inline styles applied to the <img> element.
Source: https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image/#shared-props
Depending on how's your JSX structure you may want to use one or another but answering your question: yes, there's no need of using an external .scss file, you can use inline styles as desired:
<StaticImage
imgStyle={{ width:"300vh", height:"50vh" }}
style={{ width:"300vh", height:"50vh" }}
/>
Use whichever works better for your scenario.
The project I'm working on uses react-responsive-carousel component but, although there is an attribute to change the arrows icon, there's none to increase the width of the button itself.
Is there a way for me to overwrite the padding on the component with custom css?
.carousel.carousel-slider .control-arrow {
padding: 50px;
}
I would suggest to to use custom class on container that holds carousel component, and use it to override styles safely.
In your root css file:
.my-custom-class .carousel.carousel-slider .control-arrow {
*styles*
}
I am using an external panel component which would open on a button click.It has default width and other style properties.Is there any way I can override the width of the panel and used as responsive one .what i want to achieve is programmatically change the width of the panel in my components .
For example,
In my app.component.html iam using the panel container inside app.component.html
panel-container
How can i attach a custom class
panel-container class
="panel-width"
In.css
.panel-width{
Width:500 px
}
Without changing angular default view encapsultion
You can use :host::ng-deep to style the external component.
:host::ng-deep .panel-container {
width: 500px;
}
It is deprecated since 2017, but there is no new way to do this if you do not want to change ViewEncapsulation. Source: https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep
Got the solution.
We can override the same in our parent CSS file itself.
Dont use ng deep as that s deprecated
Overwriting library styles in separate global styles — not scoped!
let's override the Angular Material tab style.
create angular material tab scss file in app > assets > scss > override > am_tab.scss
and import the am_tab.scss file in the styles.scss #import 'assets/scss/override/am_tab.scss'
// am_tab.scss
mat-tab-group {
&.mat-tab-group.mat- primary .mat-ink-bar {
background-color: red;
}
}
More read in this article
I need change color of that icon :
I try fill but it not works.
Styles of that icon
import styled from 'styled-components'
export default styled.img`
height: 14px;
padding-right: 7px;
fill: #d85040;
`
And in component :
import google from '../img/google-brands.svg'
<SocialCont>
<SocialLink>
<CompanyLogo src={google} alt="facebook"/>
<SocialText>Google</SocialText>
</SocialLink>
</SocialCont>
I use React and Styled Components.
SVG images are actually just glorified HTML elements.
You can edit your SVG images to set the fill and stroke attributes to anything you want.
You can also give SVG elements id and class attributes and use styled-components to change those.
If it is an svg passed as a source to an image, i.e. <img src="image.svg" /> , it may not be impossible to implement it. It is, however possible if you are injecting the svg code directly into the page.
In this case, simply change the fill attribute on the tags that you want to change the color on.
Since you asked this on the react channel, I'm assuming you're using React. You could simply create a component that returns the SVG so that your code may be cleaner.
I want to use draft.js in my project. It has its own css which I also need to import. In the documentation it is said:
This CSS should be included when rendering the editor, as these styles
set defaults for text alignment, spacing, and other important
features.
How do I include the Draft.css while rendering the component? Do I include it in my main index.html?
Also how to give an id to the editor so that I can style it (eg. border, padding, min-height, etc)
Depending on your setup, you should be able to include or import the Draft.css in the index.js file.
...
import 'draft-js/dist/Draft.css';
...
draftjs produces Draft.css in the build and is available within the node_modules. Use the css for default styling.
For background color of the editor, the following CSS class should be modified:
.DraftEditor-editorContainer {
background-color:#fff;
border-left:.1px solid transparent;
position:relative;
z-index:1
}