how can I completely remove button effects from a Button component in Flex ?
Background, Fill and border are completely white. But still I've a black shadow around the button (see picture bloew):
http://dl.dropbox.com/u/72686/button.png
thanks
Button {
fillAlphas: 1.0, 1.0, 1.0, 1.0;
fillColors: #FFFFFF, #FFFFFF;
themeColor: #FFFFFF;
borderColor: #FFFFFF;
cornerRadius: 0;
paddingTop: 0;
paddingLeft: 0;
paddingRight: 0;
paddingBottom: 0;
horizontalGap: 0;
leading: 0;
fontWeight: normal;
color: #000000;
textSelectedColor: #000000;
textRollOverColor: #000000;
}
skin: ClassReference(null) will not work; use the below its wokrs
upSkin: ClassReference(null);
overSkin: ClassReference(null);
downSkin: ClassReference(null);
disabledSkin: ClassReference(null);
selectedUpSkin:ClassReference(null);
selectedOverSkin: ClassReference(null);
selectedDownSkin: ClassReference(null);
selectedDisabledSkin: ClassReference(null);
You should specify the Flex version, since the newly release Flex 4 has a completely different skinning architecture.
Anyhow, I assume this is Flex 3, you could try and set this:
Button {
skin: ClassReference(null);
}
Not sure it'll work, some components choke on null skins.
If it is Flex 4, I suggest creating a skin class that does what you want, even if it is empty, and setting it like so (note the namespace, s for Spark):
s|Button {
skin-class: ClassReference('my.empty.Skin');
}
Where my.empty.Skin is the fully qualified class name for your skin.
Related
I am trying to create a const object, which is supposed to be a button with React inline styling, but :hover and :focus doesn't work. How do I implement hover and focus in React?
Any help is appreciated! Thanks in advance.
const Button= {
background: '#AC003B',
color: '#fff',
borderColor: '#AC003B',
&:hover, &:focus {
background: '#707070',
borderColor: '#707070'
}
}
I believe what you want to do is:
const Button = {
background: '#AC003B',
color: '#fff',
borderColor: '#AC003B',
'&:hover, &:focus': {
background: '#707070',
borderColor: '#707070'
}
}
I'm trying to apply some reasonably simple styles to my <Dialog> component. In this case, I am trying to round the corners with a border radius. Here are some simple inline styles that I'd like to use to override the default <Dialog> styles:
let overrideStyles = {
padding: 0,
margin: 0,
borderRadiusTopLeft: '4px',
borderRadiusTopRight: '4px',
};
<Dialog> provides a wide variety of possibilities for overriding internal styles. These include bodyStyle, contentStyle, style, titleStyle, overlayStyle, and actionsContainerStyle. I decided to try to apply these styles to each one.
<Dialog
bodyStyle={overrideStyles}
contentStyle={overrideStyles}
style={overrideStyles}
titleStyle={overrideStyles}
overlayStyle={overrideStyles}
actionsContainerStyle={overrideStyles}
modal={overrideStyles}
>
<TestPanel/>
</Dialog>
When I render my TestPanel, it ends up looking like this:
Notice the corners, where my border radius has not been applied... I opened up the inspector and noticed the following div:
If I apply the border radius styling to the highlighted div, the dialog will have its corners rounded as expected. Which leads me to my question...
How do I override the styles of Material UI's <Dialog> component to apply rounded corners as my CSS is attempting?
I solved it with paperProps property.
<Dialog PaperProps={{
style: { borderRadius: 2 } }}
> .... </Dialog>
This perfeclty worked for me
You can override styles like below.
const styles = {
root: { }
paper: { borderRadius: 15 }
}
// ...
<Dialog classes={{
root: classes.root,
paper: classes.paper
}}>
</Dialog>
Unfortunately, Material UI isn't supremely style-friendly. In this case, there's no prop you can override to change the border-radius, so we've got to apply our own class:
let headerStyles = {
color: 'white',
textAlign: 'center',
fontSize: 24,
backgroundColor: '#3B8DBC',
padding: 20,
borderTopLeftRadius: 4,
borderTopRightRadius: 4
};
let bodyStyles = {
backgroundColor: 'white',
padding: 10,
height: 200
};
<Dialog className='test'>
<div style={headerStyles}>Testing</div>
<div style={bodyStyles}>5:43pm</div>
</Dialog>
Then style that class, and, yes, the border-radius has to be set on both of the below CSS classes as well as the TestPanel header:
/* Some rules use !important because Material UI sets them by default */
.test > div > div {
background-color: #3B8DBC; /* Same background-color as TestPanel */
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.test > div > div > div {
/* Not overriding the color and border radius here too result in your changes
not being visible. */
background-color: inherit !important;
border-top-left-radius: 4px !important;
border-top-right-radius: 4px !important;
}
.test > div > div > div > div {
/* This div is the topmost padding between the modal content and the edge
of the modal */
padding: 0 !important;
}
This ends up looking like what you want:
screenshot here
Hope this helps!
You can override <Dialog /> styles globally in your application when creating your theme object. The paper key of MuiDialog will let you target the border-radius.
const theme = createMuiTheme({
overrides: {
MuiDialog: {
paper: {
borderTopLeftRadius: '4px',
borderTopRightRadius: '4px'
}
}
}
})
Dialog - CSS api
Material UI Theming
The first answer is not working for me. I tried this and it work perfect for me:
sx={{
"& .MuiDialog-container": {
"& .MuiPaper-root": {
width: "100%",
maxWidth: "740px",
borderRadius: "8px"
}
},
}}
I have a custom skin class that I want to apply to all scrollbars. Is there a way to set this globally in a Flex Spark application?
s|Scroller
{
skinClass: com.x.y;
}
Thanks guys I got it working :)
I place this code in the Application style tag (a style sheet would work as well),
<fx:Style>
#namespace s "library://ns.adobe.com/flex/spark";
#namespace mx "library://ns.adobe.com/flex/mx";
#namespace skins "skins.*";
s|HScrollBar
{
skinClass: ClassReference("skins.HScrollBarSkin");
}
s|VScrollBar
{
skinClass: ClassReference("skins.VScrollBarSkin");
}
</fx:Style>
The Best answer is that you apply that style to the parentApplication that means in the first page you just give that style and then it will apply to all the sub page. such like that
<mx:Style source="Style/Style.css" />
give that to all the parent page in your application.
Have a nice day.
Style.css
Application
{
backgroundColor: #FFFFFF;
themeColor: #6C76D3;
color: #333333;
}
.NumButton
{
color: #000000;
width: 35;
font-weight:bold;
}
Accordion
{
borderStyle: solid;
headerHeight: 32;
textIndent: 0;
openDuration: 219;
fillAlphas: 1, 1, 0.7, 0.7;
fillColors: #EBF0F3, #8E8FCC, #6273C9, #263692;
selectedFillColors: #D5DBE3, #8E8FCC;
headerStyleName: "myaccordionHeader";
}
AccordionHeader
{
borderStyle: solid;
headerHeight: 36;
textIndent: 0;
openDuration: 219;
fillAlphas: 0.4, 0.5, 0.7, 0.7;
fillColors: #DEE1FF, #AEBEFF, #8C86FF, #5646D3;
selectedFillColors: #AEBEFF, #8C86FF;
headerStyleName: "myaccordionHeader";
}
.myaccordionHeader
{
color: #1F213C;
fontFamily: Tahoma;
fontSize: 12;
}
I'm using flash builder 4.5 to make a website. At the moment I'm trying to work on the layout of my website but I'm facing some problems. First of all my CSS looks like this.
/* CSS file */
#namespace s "library://ns.adobe.com/flex/spark";
#namespace mx "library://ns.adobe.com/flex/mx";
s|Application{
backgroundColor : #ffffff;
}
mx|LinkButton{
backgroundColor : #000000;
color: #666666;
}
s|Button{
backgroundColor : #666666;
color: #666666;
}
The problem is that neither my buttons nor my linkbuttons obtain the color I have set in the above stylesheet, yet my application backgroundcolor is the color i set it to be in the above css file. So I'm sure the url for my style sheet is correct... this is it:
<fx:Style source="PsyThOn.css"/>
This is what my code looks like(a fragment)
<mx:LinkButton id="btnHome" width="100" height="30"
label="Startpagina" click="goHome(event)"/>
<mx:LinkButton id="btnProfiel" visible="{profielVisible()}" height="30"
label="Profiel" click="toonProfiel(event)"/>
Since I'm relatively new to the flex development the problem might be obvious but i can't put my finger on it.
Any help?
Is there maybe another/better way to style a flex application?
Thanks in advance.
try using chromeColor
Like this:
s|ActionBar
{
chromeColor: #229988;
titleAlign: center;
}
s|ActionBar #titleDisplay
{
color: #CCCCCC; /* default color is white */
fontSize: 40;
fontFamily: "Comic Sans MS";
}
I created a TabNavigator with a bunch of NavigatorContent inside it, and want to skin just the buttons of the tabs themselves. So I added a skinClass, but looks like in the documentation, there's no skin part to target the button specifically.
Do I have to style the mx:TabNavigator itself to accomplish this? I was hoping not since I don't know how to style mx components and am more comfortable with styling spark.
Any other alternatives that I didn't think about?
Since TabNavigator is a mx component, you'll have to style it the old way. You can style the buttons by setting the 'tabStyleName' style, ie:
TabNavigator{
tabStyleName: "myTabButton";
}
.myTabButton{
skin: ClassReference("com.yournamespace.skins.TabButtonSkin");
}
You'll have to create the skins the old way, you may want to look at the mx.skins.halo.Button class for an example, or you can use degrafa or you can use pngs.
Note you can also set a firstTabStyleName or lastTabStyleName seperately if you so desire.
programmatic skin example:
http://www.davidflatley.com/2007/12/17/programmatic-button-skins-in-flex-3/
degrafa example:
http://styleanderror.net/2010/02/creating-animated-programmatic-button-skins-in-degrafa/
You can write you own button skin or use the one here http://www.wabysabi.com/flex/enhancedbuttonskin/
named EnhancedButtonSkin.as (right-click, View-Source).
Then declare your TabNavigator component and specify its tabStyleName.
<mx:TabNavigator y="0" height="100%" right="0" left="0" id="navigator" tabStyleName="tab">
And now the css:
<fx:Style>
.tab
{
upSkin:ClassReference('com.EnhancedButtonSkin');
overSkin:ClassReference('com.EnhancedButtonSkin');
downSkin:ClassReference('com.EnhancedButtonSkin');
disabledSkin:ClassReference('com.EnhancedButtonSkin');
selectedUpSkin:ClassReference('com.EnhancedButtonSkin');
selectedOverSkin:ClassReference('com.EnhancedButtonSkin');
selectedDownSkin:ClassReference('com.EnhancedButtonSkin');
selectedDisabledSkin:ClassReference('com.EnhancedButtonSkin');
cornerRadii: 5, 5, 0, 0;
borderColors: #CC0000, #000000;
overBorderColors: #003399, #003399;
selectedBorderColors: #666666, #FFFFFF;
borderThickness: 1;
borderAlpha: 1;
fillColors: #CC3300, #F98900;
fillAlphas: 1, 1;
fillColorRatios: 0, 255;
overFillColors: #999999, #FFFFFF;
overFillAlphas: 1, 1;
overFillColorRatios: 0, 255;
selectedFillColors: #999999, #FFFFFF;
selectedFillAlphas: 1, 1;
selectedFillColorRatios: 111, 255;
highlightAlphas: 0, 0;
color: #000000;
textRollOverColor: #000000;
fontSize: 13;
}
</fx:Style>
This css will display:
i.imgur.com/4HwD3.png
Remy