Access interface of a styled component Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Misunderstanding of Styled-components conceptDynamically Styled Button in React Native using Styled Componentsstyled-components, polished and styledProps - darken() throwing errorCan't get Jest to work with Styled Components which contain themingReact.js child component not updating styling derived from props, why? (styled-components)Forwarding refs through multiple componentsPassing implementations of generic types to React component propsTypeScript: Interface cannot simultaneously extends two typesHow to type the style property for components to accept arrays?Trying to use color as a property with an emotion (styled) component causing errors in typescript

Why do we bend a book to keep it straight?

Project Euler #1 in C++

How to compare two different files line by line in unix?

AppleTVs create a chatty alternate WiFi network

As a beginner, should I get a Squier Strat with a SSS config or a HSS?

Selecting user stories during sprint planning

Do any jurisdictions seriously consider reclassifying social media websites as publishers?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

Is there any word for a place full of confusion?

Hangman Game with C++

What is the difference between globalisation and imperialism?

Can an alien society believe that their star system is the universe?

Why should I vote and accept answers?

Performance gap between vector<bool> and array

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

Find 108 by using 3,4,6

Did Deadpool rescue all of the X-Force?

What is this clumpy 20-30cm high yellow-flowered plant?

How to write the following sign?

Trademark violation for app?

Maximum summed subsequences with non-adjacent items

Does the Weapon Master feat grant you a fighting style?

Did Krishna say in Bhagavad Gita "I am in every living being"

Source for Esri sample data from 911 Hot Spot Analysis



Access interface of a styled component



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Misunderstanding of Styled-components conceptDynamically Styled Button in React Native using Styled Componentsstyled-components, polished and styledProps - darken() throwing errorCan't get Jest to work with Styled Components which contain themingReact.js child component not updating styling derived from props, why? (styled-components)Forwarding refs through multiple componentsPassing implementations of generic types to React component propsTypeScript: Interface cannot simultaneously extends two typesHow to type the style property for components to accept arrays?Trying to use color as a property with an emotion (styled) component causing errors in typescript



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Say I have a button defined like this:



interface ButtonProps 
color?: string;
size?: string;


const Button = styled("button")<ButtonProps>``;


Then I want to use it inside another component. How can I access all the props that styled-components add for the button component.



I know I can do something like this, but I feel like it gets pretty messy as components get more complex.



const ButtonGroup = (
props: ButtonProps & React.HTMLAttributes<HTMLButtonElement>
) => (
<div>
<Button ...props>Hello</Button>
<Button ...props>Hello</Button>
</div>
);


This is what I've tried so far:



const ButtonGroup: React.FunctionComponent<typeof Button> = props => (
<div>
<Button ...props>Hello</Button>
<Button ...props>Hello</Button>
</div>
);


const ButtonGroup = (props: typeof Button) => (
<div>
<Button ...props>Hello</Button>
<Button ...props>Hello</Button>
</div>
);


Edit:



Just found this, but if anyone has a cleaner solution, feel free to share.



const ButtonGroup = (props: React.ComponentProps<typeof Button>) => (
<div>
<Button ...props>Hello</Button>
<Button ...props>Hello</Button>
</div>
);









share|improve this question






























    0















    Say I have a button defined like this:



    interface ButtonProps 
    color?: string;
    size?: string;


    const Button = styled("button")<ButtonProps>``;


    Then I want to use it inside another component. How can I access all the props that styled-components add for the button component.



    I know I can do something like this, but I feel like it gets pretty messy as components get more complex.



    const ButtonGroup = (
    props: ButtonProps & React.HTMLAttributes<HTMLButtonElement>
    ) => (
    <div>
    <Button ...props>Hello</Button>
    <Button ...props>Hello</Button>
    </div>
    );


    This is what I've tried so far:



    const ButtonGroup: React.FunctionComponent<typeof Button> = props => (
    <div>
    <Button ...props>Hello</Button>
    <Button ...props>Hello</Button>
    </div>
    );


    const ButtonGroup = (props: typeof Button) => (
    <div>
    <Button ...props>Hello</Button>
    <Button ...props>Hello</Button>
    </div>
    );


    Edit:



    Just found this, but if anyone has a cleaner solution, feel free to share.



    const ButtonGroup = (props: React.ComponentProps<typeof Button>) => (
    <div>
    <Button ...props>Hello</Button>
    <Button ...props>Hello</Button>
    </div>
    );









    share|improve this question


























      0












      0








      0








      Say I have a button defined like this:



      interface ButtonProps 
      color?: string;
      size?: string;


      const Button = styled("button")<ButtonProps>``;


      Then I want to use it inside another component. How can I access all the props that styled-components add for the button component.



      I know I can do something like this, but I feel like it gets pretty messy as components get more complex.



      const ButtonGroup = (
      props: ButtonProps & React.HTMLAttributes<HTMLButtonElement>
      ) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      This is what I've tried so far:



      const ButtonGroup: React.FunctionComponent<typeof Button> = props => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      const ButtonGroup = (props: typeof Button) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      Edit:



      Just found this, but if anyone has a cleaner solution, feel free to share.



      const ButtonGroup = (props: React.ComponentProps<typeof Button>) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );









      share|improve this question
















      Say I have a button defined like this:



      interface ButtonProps 
      color?: string;
      size?: string;


      const Button = styled("button")<ButtonProps>``;


      Then I want to use it inside another component. How can I access all the props that styled-components add for the button component.



      I know I can do something like this, but I feel like it gets pretty messy as components get more complex.



      const ButtonGroup = (
      props: ButtonProps & React.HTMLAttributes<HTMLButtonElement>
      ) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      This is what I've tried so far:



      const ButtonGroup: React.FunctionComponent<typeof Button> = props => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      const ButtonGroup = (props: typeof Button) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );


      Edit:



      Just found this, but if anyone has a cleaner solution, feel free to share.



      const ButtonGroup = (props: React.ComponentProps<typeof Button>) => (
      <div>
      <Button ...props>Hello</Button>
      <Button ...props>Hello</Button>
      </div>
      );






      reactjs typescript typescript-typings styled-components






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 10:47







      Matt Thomas

















      asked Mar 22 at 10:06









      Matt ThomasMatt Thomas

      143116




      143116






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297222%2faccess-interface-of-a-styled-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297222%2faccess-interface-of-a-styled-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴