<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.19.1</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>119</ContextCount>
  <ElementCount>211</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>37</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>5</UnitCount>
  <MyReports>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>1001 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/DocumentAndEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>1002 - Statement - Consolidated Statements of Comprehensive Income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/ConsolidatedStatementsOfComprehensiveIncome</Role>
      <ShortName>Consolidated Statements of Comprehensive Income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>1003 - Statement - Consolidated Balance Sheets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/ConsolidatedBalanceSheets</Role>
      <ShortName>Consolidated Balance Sheets</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>1004 - Statement - Consolidated Balance Sheets (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/ConsolidatedBalanceSheetsParenthetical</Role>
      <ShortName>Consolidated Balance Sheets (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>1005 - Statement - Statements of Changes in Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StatementsOfChangesInStockholdersEquity</Role>
      <ShortName>Statements of Changes in Stockholders' Equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>1006 - Statement - Consolidated Statements of Cash Flows</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/ConsolidatedStatementsOfCashFlows</Role>
      <ShortName>Consolidated Statements of Cash Flows</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>1007 - Disclosure - Business and Organization</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/BusinessAndOrganization</Role>
      <ShortName>Business and Organization</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>1008 - Disclosure - Basis of Presentation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/BasisOfPresentation</Role>
      <ShortName>Basis of Presentation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>1009 - Disclosure - Recently Adopted Accounting Standards</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RecentlyAdoptedAccountingStandards</Role>
      <ShortName>Recently Adopted Accounting Standards</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>1010 - Disclosure - New Accounting Standards Not Yet Adopted</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/NewAccountingStandardsNotYetAdopted</Role>
      <ShortName>New Accounting Standards Not Yet Adopted</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>1011 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/Inventories</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>1012 - Disclosure - Prepaid Expenses and Other Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/PrepaidExpensesAndOtherAssets</Role>
      <ShortName>Prepaid Expenses and Other Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>1013 - Disclosure - Goodwill and Other Intangible Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/GoodwillAndOtherIntangibleAssets</Role>
      <ShortName>Goodwill and Other Intangible Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>1014 - Disclosure - Accrued Expenses and Other Liabilities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/AccruedExpensesAndOtherLiabilities</Role>
      <ShortName>Accrued Expenses and Other Liabilities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>1015 - Disclosure - Debt</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/Debt</Role>
      <ShortName>Debt</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>1016 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/Leases</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>1017 - Disclosure - Financial Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/FinancialInstruments</Role>
      <ShortName>Financial Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>1018 - Disclosure - Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockholdersEquity</Role>
      <ShortName>Stockholders' Equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>1019 - Disclosure - Revenue From Contracts With Customers</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RevenueFromContractsWithCustomers</Role>
      <ShortName>Revenue From Contracts With Customers</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>1020 - Disclosure - Stock-Based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensation</Role>
      <ShortName>Stock-Based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>1021 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/IncomeTaxes</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>1022 - Disclosure - Segment Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/SegmentInformation</Role>
      <ShortName>Segment Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>1023 - Disclosure - Seasonality</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/Seasonality</Role>
      <ShortName>Seasonality</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>23</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>1024 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/CommitmentsAndContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>24</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>1025 - Disclosure - Stock-Based Compensation (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationPolicies</Role>
      <ShortName>Stock-Based Compensation (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://www.trex.com/role/RecentlyAdoptedAccountingStandards</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>1026 - Disclosure - Inventories (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/InventoriesTables</Role>
      <ShortName>Inventories (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/Inventories</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>1027 - Disclosure - Prepaid Expenses and Other Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/PrepaidExpensesAndOtherAssetsTables</Role>
      <ShortName>Prepaid Expenses and Other Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/PrepaidExpensesAndOtherAssets</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>1028 - Disclosure - Goodwill and Other Intangible Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsTables</Role>
      <ShortName>Goodwill and Other Intangible Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/GoodwillAndOtherIntangibleAssets</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>1029 - Disclosure - Accrued Expenses and Other Liabilities (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesTables</Role>
      <ShortName>Accrued Expenses and Other Liabilities (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/AccruedExpensesAndOtherLiabilities</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>1030 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/LeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/Leases</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>1031 - Disclosure - Stockholders' Equity (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockholdersEquityTables</Role>
      <ShortName>Stockholders' Equity (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/StockholdersEquity</ParentRole>
      <Position>31</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>1032 - Disclosure - Revenue From Contracts With Customers (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RevenueFromContractsWithCustomersTables</Role>
      <ShortName>Revenue From Contracts With Customers (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/RevenueFromContractsWithCustomers</ParentRole>
      <Position>32</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>1033 - Disclosure - Stock-Based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationTables</Role>
      <ShortName>Stock-Based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/StockBasedCompensation</ParentRole>
      <Position>33</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>1034 - Disclosure - Segment Information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/SegmentInformationTables</Role>
      <ShortName>Segment Information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/SegmentInformation</ParentRole>
      <Position>34</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>1035 - Disclosure - Commitments and Contingencies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/CommitmentsAndContingenciesTables</Role>
      <ShortName>Commitments and Contingencies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/role/CommitmentsAndContingencies</ParentRole>
      <Position>35</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>1036 - Disclosure - Business and Organization - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/BusinessAndOrganizationAdditionalInformationDetail</Role>
      <ShortName>Business and Organization - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>1037 - Disclosure - Recently Adopted Accounting Standards - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RecentlyAdoptedAccountingStandardsAdditionalInformationDetail</Role>
      <ShortName>Recently Adopted Accounting Standards - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>1038 - Disclosure - Inventories - Summary of Inventories (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/InventoriesSummaryOfInventoriesDetail</Role>
      <ShortName>Inventories - Summary of Inventories (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>1039 - Disclosure - Inventories - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/InventoriesAdditionalInformationDetail</Role>
      <ShortName>Inventories - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>1040 - Disclosure - Prepaid Expenses and Other Assets - Summary of Prepaid Expenses and Other Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail</Role>
      <ShortName>Prepaid Expenses and Other Assets - Summary of Prepaid Expenses and Other Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>1041 - Disclosure - Goodwill and Other Intangible Assets - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsAdditionalInformationDetail</Role>
      <ShortName>Goodwill and Other Intangible Assets - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>1042 - Disclosure - Goodwill and Other Intangible Assets - Details of Intangible Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsDetailsOfIntangibleAssetsDetail</Role>
      <ShortName>Goodwill and Other Intangible Assets - Details of Intangible Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>1043 - Disclosure - Accrued Expenses and Other Liabilities - Summary of Accrued Expenses and Other Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail</Role>
      <ShortName>Accrued Expenses and Other Liabilities - Summary of Accrued Expenses and Other Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>1044 - Disclosure - Debt - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/DebtAdditionalInformationDetail</Role>
      <ShortName>Debt - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>1045 - Disclosure - Leases - Supplemental Cash flow Information to operating leases (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/LeasesSupplementalCashFlowInformationToOperatingLeasesDetails</Role>
      <ShortName>Leases - Supplemental Cash flow Information to operating leases (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>1046 - Disclosure - Leases - Maturities of Operating Lease Liabilities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails</Role>
      <ShortName>Leases - Maturities of Operating Lease Liabilities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>1047 - Disclosure - Leases - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/LeasesAdditionalInformationDetail</Role>
      <ShortName>Leases - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>1048 - Disclosure - Stockholders' Equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockholdersEquityAdditionalInformationDetail</Role>
      <ShortName>Stockholders' Equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>1049 - Disclosure - Stockholders' Equity - Computation of Basic and Diluted Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockholdersEquityComputationOfBasicAndDilutedEarningsPerShareDetail</Role>
      <ShortName>Stockholders' Equity - Computation of Basic and Diluted Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>1050 - Disclosure - Stockholders' Equity - Antidilutive Securities Excluded from Computation of Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockholdersEquityAntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareDetail</Role>
      <ShortName>Stockholders' Equity - Antidilutive Securities Excluded from Computation of Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>1051 - Disclosure - Revenue From Contracts With Customers - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RevenueFromContractsWithCustomersAdditionalInformationDetail</Role>
      <ShortName>Revenue From Contracts With Customers - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>51</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>1052 - Disclosure - Revenue From Contracts With Customers - Summary of Disaggregated Net Sales (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/RevenueFromContractsWithCustomersSummaryOfDisaggregatedNetSalesDetail</Role>
      <ShortName>Revenue From Contracts With Customers - Summary of Disaggregated Net Sales (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>1053 - Disclosure - Stock-Based Compensation - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationAdditionalInformationDetail</Role>
      <ShortName>Stock-Based Compensation - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>1054 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Grants (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationSummaryOfStockBasedCompensationGrantsDetail</Role>
      <ShortName>Stock-Based Compensation - Summary of Stock-Based Compensation Grants (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>1055 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Grants (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationSummaryOfStockBasedCompensationGrantsParentheticalDetail</Role>
      <ShortName>Stock-Based Compensation - Summary of Stock-Based Compensation Grants (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>1056 - Disclosure - Stock-Based Compensation - Summary of Assumptions Used to Estimate Fair Value of Each SAR (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationSummaryOfAssumptionsUsedToEstimateFairValueOfEachSarDetail</Role>
      <ShortName>Stock-Based Compensation - Summary of Assumptions Used to Estimate Fair Value of Each SAR (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>1057 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Expenses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/StockBasedCompensationSummaryOfStockBasedCompensationExpensesDetail</Role>
      <ShortName>Stock-Based Compensation - Summary of Stock-Based Compensation Expenses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>1058 - Disclosure - Income Taxes - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/IncomeTaxesAdditionalInformationDetail</Role>
      <ShortName>Income Taxes - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>1059 - Disclosure - Segment Information - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/SegmentInformationAdditionalInformationDetail</Role>
      <ShortName>Segment Information - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>1060 - Disclosure - Segment Information - Details of Segment Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/SegmentInformationDetailsOfSegmentInformationDetail</Role>
      <ShortName>Segment Information - Details of Segment Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>1061 - Disclosure - Segment Information - Schedule of Reconciliation of Net Income to EBITDA (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/SegmentInformationScheduleOfReconciliationOfNetIncomeToEbitdaDetail</Role>
      <ShortName>Segment Information - Schedule of Reconciliation of Net Income to EBITDA (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>61</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>1062 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/CommitmentsAndContingenciesAdditionalInformationDetail</Role>
      <ShortName>Commitments and Contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>62</Position>
    </Report>
    <Report instance="trex-20190331.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>1063 - Disclosure - Commitments and Contingencies - Summary of Reconciliation of Company's Residential Product Warranty Reserve (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/role/CommitmentsAndContingenciesSummaryOfReconciliationOfCompanysResidentialProductWarrantyReserveDetail</Role>
      <ShortName>Commitments and Contingencies - Summary of Reconciliation of Company's Residential Product Warranty Reserve (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>63</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File>trex-20190331.xml</File>
    <File>trex-20190331.xsd</File>
    <File>trex-20190331_cal.xml</File>
    <File>trex-20190331_def.xml</File>
    <File>trex-20190331_lab.xml</File>
    <File>trex-20190331_pre.xml</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy>http://xbrl.sec.gov/dei/2018-01-31</BaseTaxonomy>
    <BaseTaxonomy>http://fasb.org/srt/2018-01-31</BaseTaxonomy>
    <BaseTaxonomy>http://fasb.org/us-gaap/2018-01-31</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
