Package com.vaadin.flow.component
Interface HasStyle
- All Superinterfaces:
HasElement,Serializable
- All Known Subinterfaces:
FlexComponent,InputField<E,V>
- All Known Implementing Classes:
AbstractCompositeField,AbstractField,AbstractIcon,AbstractLogin,AbstractNumberField,AbstractRouteNotFoundError,AbstractSinglePropertyField,Accordion,AccordionPanel,Anchor,AppLayout,Article,Aside,Avatar,AvatarGroup,BigDecimalField,Board,Button,Card,Chart,Checkbox,CheckboxGroup,CollaborationAvatarGroup,CollaborationMessageInput,CollaborationMessageList,ComboBox,ComboBoxBase,Component,Composite,ConfirmDialog,ContextMenu,ContextMenuBase,CookieConsent,Crud,CrudGrid,CustomField,Dashboard,DashboardSection,DashboardWidget,DatePicker,DateTimePicker,DescriptionList,DescriptionList.Description,DescriptionList.Term,Details,Dialog,Div,DrawerToggle,EmailField,Emphasis,FieldSet,FieldSet.Legend,FlexLayout,FontIcon,Footer,FormLayout,FormLayout.FormItem,Grid,Grid.Column,GridContextMenu,GridMenuItem,GridPro,GridPro.EditColumn,GridSelectionColumn,H1,H2,H3,H4,H5,H6,Header,HorizontalLayout,Hr,Html,HtmlComponent,HtmlContainer,HtmlObject,Icon,IFrame,Image,Input,IntegerField,InternalServerError,Label,ListBox,ListBoxBase,ListItem,LitTemplate,LoginForm,LoginOverlay,Main,Map,MapBase,MenuBar,MenuItem,MenuItemBase,MessageInput,MessageList,MultiSelectComboBox,MultiSelectListBox,NativeButton,NativeDetails,NativeDetails.Summary,NativeLabel,NativeTable,NativeTableBody,NativeTableCaption,NativeTableCell,NativeTableFooter,NativeTableHeader,NativeTableHeaderCell,NativeTableRow,Nav,Notification,NumberField,OrderedList,Paragraph,Param,PasswordField,Popover,Pre,ProgressBar,RadioButtonGroup,RangeInput,ReactAdapterComponent,ReactRouterOutlet,RichTextEditor,RouteAccessDeniedError,RouteNotFoundError,RouterLink,Row,Scroller,Section,Select,SideNav,SideNavItem,Span,SplitLayout,Svg,SvgIcon,Tab,Tabs,TabSheet,Text,TextArea,TextField,TextFieldBase,TimePicker,TreeGrid,UI,UI.ClientViewPlaceholder,UnorderedList,Upload,VerticalLayout,VirtualList,WebComponentUI,WebComponentWrapper
Represents
Component which has class attribute and inline styles.
Implementation of HasElement.getElement() should return HTML element or web
component that supports inline
style attribute.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddClassName(String className) Adds a CSS class name to this component.default voidaddClassNames(String... classNames) Adds one or more CSS class names to this component.default StringGets the CSS class names for this component.default ClassListGets the set of CSS class names used for this element.default StylegetStyle()Gets the style instance for managing inline styles for the element of this component.default booleanhasClassName(String className) Checks if the component has the given class name.default booleanremoveClassName(String className) Removes a CSS class name from this component.default voidremoveClassNames(String... classNames) Removes one or more CSS class names from component.default voidsetClassName(String className) Sets the CSS class names of this component.default voidsetClassName(String className, boolean set) Sets or removes the given class name for this component.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
addClassName
Adds a CSS class name to this component.- Parameters:
className- the CSS class name to add, notnull
-
removeClassName
Removes a CSS class name from this component.- Parameters:
className- the CSS class name to remove, notnull- Returns:
trueif the class name was removed,falseif the class list didn't contain the class name
-
setClassName
Sets the CSS class names of this component. This method overwrites any previous set class names.- Parameters:
className- a space-separated string of class names to set, ornullto remove all class names
-
getClassName
Gets the CSS class names for this component.- Returns:
- a space-separated string of class names, or
nullif there are no class names
-
getClassNames
Gets the set of CSS class names used for this element. The returned set can be modified to add or remove class names. The contents of the set is also reflected in the value of theclassattribute.Despite the name implying a list being returned, the return type is actually a
Setsince the in-browser return value behaves like aSetin Java.- Returns:
- a list of class names, never
null - See Also:
-
setClassName
Sets or removes the given class name for this component.- Parameters:
className- the class name to set or remove, notnullset-trueto set the class name,falseto remove it
-
hasClassName
Checks if the component has the given class name.- Parameters:
className- the class name to check for- Returns:
trueif the component has the given class name,falseotherwise
-
getStyle
Gets the style instance for managing inline styles for the element of this component.- Returns:
- the style object for the element, not
null
-
addClassNames
Adds one or more CSS class names to this component. Multiple class names can be specified by using spaces or by giving multiple parameters.- Parameters:
classNames- the CSS class name or class names to be added to the component
-
removeClassNames
Removes one or more CSS class names from component. Multiple class names can be specified by using spaces or by giving multiple parameters.- Parameters:
classNames- the CSS class name or class names to be removed from the component
-