Using components with variants in library


Is there a way of using components inside a library. I woul like to create a primary and secondary button as component with two variants in my library. At the moment I have the two button styles as two different widgets in the library.